Interface SynonymService


  • public interface SynonymService
    Service for managing synonyms in the search engine.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deleteSynonym​(Synonym synonym, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Delete a synonym.
      void loadSynonyms​(LoadSynonymProperties loadSynonymProperties)
      Load any default synonyms.
      Optional<Synonym> readSynonym​(String word, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read a single synonym
      List<Synonym> readSynonyms​(com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read all synonyms for a language
      Synonym updateSynonym​(Synonym synonym, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Update/add a synonym.
      List<Synonym> updateSynonyms​(Collection<Synonym> synonyms, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Update multiple synonyms.
    • Method Detail

      • readSynonyms

        List<Synonym> readSynonyms​(com.broadleafcommerce.search.api.type.IndexableType indexableType,
                                   Locale locale,
                                   com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Read all synonyms for a language
        Parameters:
        indexableType - The target indexable type
        locale - The target locale
        contextInfo - Context containing information about current tenant and application
        Returns:
        A list of synonyms for a language
      • readSynonym

        Optional<Synonym> readSynonym​(String word,
                                      com.broadleafcommerce.search.api.type.IndexableType indexableType,
                                      Locale locale,
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Read a single synonym
        Parameters:
        word - The target word
        indexableType - The target indexable type
        locale - The target locale
        contextInfo - Context containing information about current tenant and application
        Returns:
        Synonyms for the request word, if they exist.
      • updateSynonym

        Synonym updateSynonym​(Synonym synonym,
                              com.broadleafcommerce.search.api.type.IndexableType indexableType,
                              Locale locale,
                              com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Update/add a synonym. This will create the synonym for the currently active collection, as well as its background collection.
        Parameters:
        synonym - The synonym to update/add
        indexableType - The target indexable type
        locale - the target locale
        contextInfo - Context containing information about current tenant and application
        Returns:
        The created synonym
      • updateSynonyms

        List<Synonym> updateSynonyms​(Collection<Synonym> synonyms,
                                     com.broadleafcommerce.search.api.type.IndexableType indexableType,
                                     Locale locale,
                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Update multiple synonyms. This updates for the currently active collection as well as its background collection.
        Parameters:
        synonyms - The synonyms to update
        indexableType - The target indexable type
        locale - The locale
        contextInfo - Context containing information about current tenant and application
        Returns:
        The updated synonyms
      • deleteSynonym

        void deleteSynonym​(Synonym synonym,
                           com.broadleafcommerce.search.api.type.IndexableType indexableType,
                           Locale locale,
                           com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Delete a synonym. This will delete from the currently active collection as well as its background collection.
        Parameters:
        synonym - The synonym to delete
        indexableType - The target indexable type
        locale - The target locale
        contextInfo - Context containing information about current tenant and application
      • loadSynonyms

        void loadSynonyms​(@Nullable
                          LoadSynonymProperties loadSynonymProperties)
        Load any default synonyms. This will only execute if there are no existing synonyms for a target collection and language.
        Parameters:
        loadSynonymProperties - Properties containing information on synonyms to load.