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
Each module has the flexibility to handle/specify query by registering a OmniSearchHandler
  • Field Details

  • Method Details

    • getSearchResults

      Map<String,SearchResult> getSearchResults(ResourceResolver resolver, Map<String,?> predicateParameters, long limit, long offset)
      This function returns the search result for OmniSearch. Depending on predicateParamters, 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 instance
      predicateParameters - Map of parameters this should be in format of <String, String> or <String, String[]>
      limit - number of result on a page
      offset - 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 as SearchResult.
    • getSuggestions

      Map<String,SuggestionResult> getSuggestions(ResourceResolver resolver, I18n i18n, String term, String location)
      This function will return suggestions for omnisearch. Suggestion Result will be in format of Map with key as String and Value as SuggestionResult If user does not have access to any module, that module will not be present in search Results.
      Parameters:
      resolver - ResourceResolver instance
      i18n - I18n instance
      term - text term for which suggestions are require
      location - this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION.
      Returns:
      Map
    • getModules

      Map<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:
    • getModuleConfiguration

      Resource getModuleConfiguration(ResourceResolver resolver, String location)
      This function will return the configuration Resource of the search modules that is registered with OmniSearch.
      Parameters:
      resolver - ResourceResolver instance
      location - this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION.
      Returns:
      resource
    • getSavedSearches

      Iterator<Resource> getSavedSearches(ResourceResolver resolver, 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 has SavedSearchHandler implemented
      Parameters:
      resolver - ResourceResolver instance
      location - this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION.
      limit - number of result on a page
      offset - offset for next page result
      Returns:
      Iterator of Resource of nodes of saved search for the module.
      Throws:
      OmniSearchException - instance of OmniSearchException which provide error from the module
    • getSavedSearchParameters

      Map<String,String> getSavedSearchParameters(ResourceResolver resolver, String location, String path) throws OmniSearchException
      This function returns the details of saved Query parameters for the particular saved search.
      Parameters:
      resolver - ResourceResolver instance
      location - this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION
      path - path of the node of saved search, from which parameters of saved search Query required
      Returns:
      Map containing parameters of the Query
      Throws:
      OmniSearchException - instance of OmniSearchException which provide error from the module
    • createOrUpdateSavedSearch

      Resource createOrUpdateSavedSearch(ResourceResolver resolver, Map<String,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 instance
      requestParameters - Map of the parameters in format <String, String> or <String, String[]> containing all parameters that needed to be saved as Query parameter
      Returns:
      ResourceResolver instance
      Throws:
      OmniSearchException - instance of OmniSearchException which provide error from the module
    • deleteSavedSearch

      boolean deleteSavedSearch(ResourceResolver resolver, String location, String path) throws OmniSearchException
      This function delete the saved search node existing on the provided path
      Parameters:
      resolver - ResourceResolver instance
      location - this is unique id for each module @see com.adobe.granite.omnisearch.api.core.OmniSearchService#LOCATION
      path - path of the node of saved search to delete
      Returns:
      true, if node deleted successfully, false otherwise.
      Throws:
      OmniSearchException - instance of OmniSearchException which provide error from the module