Interface SynonymService


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

    Modifier and Type
    Method
    Description
    void
    deleteSynonym(Synonym synonym, com.broadleafcommerce.search.api.type.IndexableType indexableType, String managedLanguage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Delete a synonym.
    getAvailableLanguages(String indexableType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Return a list of managed languages for the supplied indexable type.
    void
    Load any default synonyms.
    readSynonym(String word, com.broadleafcommerce.search.api.type.IndexableType indexableType, String managedLanguage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read a single synonym
    readSynonyms(com.broadleafcommerce.search.api.type.IndexableType indexableType, String managedLanguage, cz.jirutka.rsql.parser.ast.Node filters, String query, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Read all synonyms for a language
    updateSynonym(Synonym synonym, com.broadleafcommerce.search.api.type.IndexableType indexableType, String managedLanguage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update/add a synonym.
    updateSynonyms(Collection<Synonym> synonyms, com.broadleafcommerce.search.api.type.IndexableType indexableType, String managedLanguage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update multiple synonyms.
  • Method Details

    • readSynonyms

      List<Synonym> readSynonyms(com.broadleafcommerce.search.api.type.IndexableType indexableType, String managedLanguage, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable String query, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read all synonyms for a language
      Parameters:
      indexableType - The target indexable type
      managedLanguage - The managed language
      query - The filter query. This filters by the "main" word or any of the synonyms.
      filters - The RSQL node to filter the synonyms (For future state. currently unused)
      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, String managedLanguage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Read a single synonym
      Parameters:
      word - The target word
      indexableType - The target indexable type
      managedLanguage - The managed language
      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, String managedLanguage, 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
      managedLanguage - The managed language
      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, String managedLanguage, 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
      managedLanguage - The managed language
      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, String managedLanguage, 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
      managedLanguage - The target locale
      contextInfo - Context containing information about current tenant and application
    • getAvailableLanguages

      List<ManagedLanguage> getAvailableLanguages(String indexableType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Return a list of managed languages for the supplied indexable type.
      Parameters:
      indexableType - The target indexable type
      contextInfo - Context containing information about current tenant and application
      Returns:
      A list of managed languages
    • loadSynonyms

      void loadSynonyms()
      Load any default synonyms. This will only execute if there are no existing synonyms for a target collection and language. See SynonymProperties.getConfig()