Interface SynonymService
public interface SynonymService
Service for managing synonyms in the search engine.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSynonym(Synonym synonym, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Delete a synonym.voidloadSynonyms(LoadSynonymProperties loadSynonymProperties) Load any default synonyms.readSynonym(String word, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read a single synonymreadSynonyms(com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all synonyms for a languageupdateSynonym(Synonym synonym, com.broadleafcommerce.search.api.type.IndexableType indexableType, Locale locale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update/add a 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 Details
-
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 typelocale- The target localecontextInfo- 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 wordindexableType- The target indexable typelocale- The target localecontextInfo- 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/addindexableType- The target indexable typelocale- the target localecontextInfo- 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 updateindexableType- The target indexable typelocale- The localecontextInfo- 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 deleteindexableType- The target indexable typelocale- The target localecontextInfo- Context containing information about current tenant and application
-
loadSynonyms
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.
-