Interface OmniSearchService
-
@ProviderType public interface OmniSearchService
OmniSearch enables different search modules (or location) to plugin with common and unified search interface i.e. OmniSearch. A search module generally handles search related to a one or more resource type i.e. Asset, Site, User, Group, Asset Collection etc. OmniSearch enables couple of key functionalities- Suggestions & SpellCheck
- Predicate Suggestions
- Common Search - search across all modules
- Search within a particular module i.e. Asset
- Saved Search functionality for the module that implements
SavedSearchHandler
OmniSearchHandler
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLOCATIONLocation has 1:1 mapping with a search module.static intMIN_LENGTH_FOR_SUGGESTIONstatic java.lang.StringMIN_LENGTH_SUGGESTION_PROPERTYstatic booleanSPELLCHECK_REQUIREstatic java.lang.StringSPELLCHECK_REQUIRE_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResourcecreateOrUpdateSavedSearch(ResourceResolver resolver, java.util.Map<java.lang.String,java.lang.Object> requestParameters)This function creates a new saved search or updates a existing saved search based on the parameters provided in predicateMap parameter.booleandeleteSavedSearch(ResourceResolver resolver, java.lang.String location, java.lang.String path)This function delete the saved search node existing on the provided pathResourcegetModuleConfiguration(ResourceResolver resolver, java.lang.String location)This function will return the configurationResourceof the search modules that is registered with OmniSearch.java.util.Map<java.lang.String,Resource>getModules(ResourceResolver resolver)This function will return all search modules and their configuration that are registered with OmniSearch.java.util.Iterator<Resource>getSavedSearches(ResourceResolver resolver, java.lang.String location, long limit, long offset)This function returns the list of saved searches for the particular module that is register with omnisearch and hasSavedSearchHandlerimplementedjava.util.Map<java.lang.String,java.lang.String>getSavedSearchParameters(ResourceResolver resolver, java.lang.String location, java.lang.String path)This function returns the details of savedQueryparameters for the particular saved search.java.util.Map<java.lang.String,SearchResult>getSearchResults(ResourceResolver resolver, java.util.Map<java.lang.String,?> predicateParameters, long limit, long offset)This function returns the search result for OmniSearch.java.util.Map<java.lang.String,SuggestionResult>getSuggestions(ResourceResolver resolver, I18n i18n, java.lang.String term, java.lang.String location)This function will return suggestions for omnisearch.
-
-
-
Field Detail
-
LOCATION
static final java.lang.String LOCATION
Location has 1:1 mapping with a search module.locationin search request parameter, can specify particular search module to search. i.e. if location = "x", then omnisearch would only search module that has ID = "x"- See Also:
OmniSearchHandler.getID(), Constant Field Values
-
MIN_LENGTH_SUGGESTION_PROPERTY
static final java.lang.String MIN_LENGTH_SUGGESTION_PROPERTY
- See Also:
- Constant Field Values
-
SPELLCHECK_REQUIRE_PROPERTY
static final java.lang.String SPELLCHECK_REQUIRE_PROPERTY
- See Also:
- Constant Field Values
-
MIN_LENGTH_FOR_SUGGESTION
static final int MIN_LENGTH_FOR_SUGGESTION
- See Also:
- Constant Field Values
-
SPELLCHECK_REQUIRE
static final boolean SPELLCHECK_REQUIRE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSearchResults
java.util.Map<java.lang.String,SearchResult> getSearchResults(ResourceResolver resolver, java.util.Map<java.lang.String,?> predicateParameters, long limit, long offset)
This function returns the search result for OmniSearch. Depending onpredicateParamters, it could contain results from multiple search modules or one of the search module. If user does not have access to any module, that module will not be present in search Results.- Parameters:
resolver-ResourceResolverinstancepredicateParameters- Map of parameters this should be in format of <String, String> or <String, String[]>limit- number of result on a pageoffset- pffset for next page result @return- Returns:
- Return Results in format
Mapwith Key as location @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION , and Value asSearchResult.
-
getSuggestions
java.util.Map<java.lang.String,SuggestionResult> getSuggestions(ResourceResolver resolver, I18n i18n, java.lang.String term, java.lang.String location)
This function will return suggestions for omnisearch. Suggestion Result will be in format ofMapwith key as String and Value asSuggestionResultIf user does not have access to any module, that module will not be present in search Results.- Parameters:
resolver-ResourceResolverinstancei18n- I18n instanceterm- text term for which suggestions are requirelocation- this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION.- Returns:
- Map
-
getModules
java.util.Map<java.lang.String,Resource> getModules(ResourceResolver resolver)
This function will return all search modules and their configuration that are registered with OmniSearch.- Parameters:
resolver-ResourceResolverinstance- Returns:
- a map with key as
locationand value as configuration resource - See Also:
OmniSearchHandler.getModuleConfig(org.apache.sling.api.resource.ResourceResolver)
-
getModuleConfiguration
Resource getModuleConfiguration(ResourceResolver resolver, java.lang.String location)
This function will return the configurationResourceof the search modules that is registered with OmniSearch.- Parameters:
resolver-ResourceResolverinstancelocation- this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION.- Returns:
- resource
-
getSavedSearches
java.util.Iterator<Resource> getSavedSearches(ResourceResolver resolver, java.lang.String location, long limit, long offset) throws OmniSearchException
This function returns the list of saved searches for the particular module that is register with omnisearch and hasSavedSearchHandlerimplemented- Parameters:
resolver-ResourceResolverinstancelocation- this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION.limit- number of result on a pageoffset- offset for next page result- Returns:
IteratorofResourceof nodes of saved search for the module.- Throws:
OmniSearchException- instance ofOmniSearchExceptionwhich provide error from the module
-
getSavedSearchParameters
java.util.Map<java.lang.String,java.lang.String> getSavedSearchParameters(ResourceResolver resolver, java.lang.String location, java.lang.String path) throws OmniSearchException
This function returns the details of savedQueryparameters for the particular saved search.- Parameters:
resolver-ResourceResolverinstancelocation- this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATIONpath- path of the node of saved search, from which parameters of saved searchQueryrequired- Returns:
Mapcontaining parameters of theQuery- Throws:
OmniSearchException- instance ofOmniSearchExceptionwhich provide error from the module
-
createOrUpdateSavedSearch
Resource createOrUpdateSavedSearch(ResourceResolver resolver, java.util.Map<java.lang.String,java.lang.Object> requestParameters) throws OmniSearchException
This function creates a new saved search or updates a existing saved search based on the parameters provided in predicateMap parameter.- Parameters:
resolver-ResourceResolverinstancerequestParameters-Mapof the parameters in format <String, String> or <String, String[]> containing all parameters that needed to be saved asQueryparameter- Returns:
ResourceResolverinstance- Throws:
OmniSearchException- instance ofOmniSearchExceptionwhich provide error from the module
-
deleteSavedSearch
boolean deleteSavedSearch(ResourceResolver resolver, java.lang.String location, java.lang.String path) throws OmniSearchException
This function delete the saved search node existing on the provided path- Parameters:
resolver-ResourceResolverinstancelocation- this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATIONpath- path of the node of saved search to delete- Returns:
- true, if node deleted successfully, false otherwise.
- Throws:
OmniSearchException- instance ofOmniSearchExceptionwhich provide error from the module
-
-