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.String
LOCATION
Location has 1:1 mapping with a search module.static int
MIN_LENGTH_FOR_SUGGESTION
static java.lang.String
MIN_LENGTH_SUGGESTION_PROPERTY
static boolean
SPELLCHECK_REQUIRE
static java.lang.String
SPELLCHECK_REQUIRE_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Resource
createOrUpdateSavedSearch(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.boolean
deleteSavedSearch(ResourceResolver resolver, java.lang.String location, java.lang.String path)
This function delete the saved search node existing on the provided pathResource
getModuleConfiguration(ResourceResolver resolver, java.lang.String location)
This function will return the configurationResource
of 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 hasSavedSearchHandler
implementedjava.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 savedQuery
parameters 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.location
in 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
-ResourceResolver
instancepredicateParameters
- 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
Map
with 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 ofMap
with key as String and Value asSuggestionResult
If user does not have access to any module, that module will not be present in search Results.- Parameters:
resolver
-ResourceResolver
instancei18n
- 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
-ResourceResolver
instance- Returns:
- a map with key as
location
and 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 configurationResource
of the search modules that is registered with OmniSearch.- Parameters:
resolver
-ResourceResolver
instancelocation
- 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 hasSavedSearchHandler
implemented- Parameters:
resolver
-ResourceResolver
instancelocation
- 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:
Iterator
ofResource
of nodes of saved search for the module.- Throws:
OmniSearchException
- instance ofOmniSearchException
which 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 savedQuery
parameters for the particular saved search.- Parameters:
resolver
-ResourceResolver
instancelocation
- 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 searchQuery
required- Returns:
Map
containing parameters of theQuery
- Throws:
OmniSearchException
- instance ofOmniSearchException
which 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
-ResourceResolver
instancerequestParameters
-Map
of the parameters in format <String, String> or <String, String[]> containing all parameters that needed to be saved asQuery
parameter- Returns:
ResourceResolver
instance- Throws:
OmniSearchException
- instance ofOmniSearchException
which 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
-ResourceResolver
instancelocation
- 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 ofOmniSearchException
which provide error from the module
-
-