Interface OmniSearchHandler

All Known Implementing Classes:
AbstractOmniSearchHandler

@ConsumerType public interface OmniSearchHandler
A service provider OmniSearchHandler interface i.e. search module Assets, Sites would need to implement this interface. OmniSearch allows different modules to register themselves, by implementing this interface.
  • Method Details

    • getID

      String getID()
      This function returns ID of SuggestionHandler aka Search Module This ID helps identify the search module uniquely i.e. assets, sites, projects etc.
      Returns:
      ID of SuggestionHandler
    • getSuggestionQuery

      Query getSuggestionQuery(ResourceResolver resolver, String term)
      This function returns Query that provides suggestions query for module
      Parameters:
      resolver - ResourceResolver instance
      term - text term for which suggestions are require
      Returns:
      Query that returns suggestions on execution
    • getPredicateSuggestions

      List<PredicateSuggestion> getPredicateSuggestions(ResourceResolver resolver, I18n i18n, String term)
      This function provide predicate suggestions for the current search term. Predicates generally have known limited values i.e. File Type predicate may have Images, Documents, Videos as values. So, if search term is "Ima", it should return predicate "File Type: Images"
      Parameters:
      resolver - ResourceResolver instance
      i18n - I18n instance
      term - text term for which suggestions are require
      Returns:
      List of Predicates
    • getSpellCheckQuery

      Query getSpellCheckQuery(ResourceResolver resolver, String searchTerm)
      This function return the Spell Check suggestion according to the search term. This enables did you mean functionality
      Parameters:
      resolver - ResourceResolver instance
      searchTerm - text term for which suggestions are require @return List of Predicates
      Returns:
      Query
    • getModuleConfig

      Resource getModuleConfig(ResourceResolver resolver)
      Every search module will store additional configuration i.e. itemCardType itemListType to specify configuration that can be used to represent search module resources i.e. assets, sites, users, groups. This api returns such a resource that stores the config. Additionally, this allows ability to control the visibility of particular search module to a user. If a user does not have access to this resource. OmniSearch will not include this search module in its searches i.e. suggestions, search etc.
      Parameters:
      resolver - ResourceResolver instance
      Returns:
      Resource of content Node
    • getResults

      SearchResult getResults(ResourceResolver resolver, Map<String,Object> predicateParameters, long limit, long offset)
      returns the search results.
      Parameters:
      resolver - ResourceResolver instance
      predicateParameters - search predicate parameter map. Each module is independent to do search based on existing mechanism i.e. Oak Query enginer, QueryBuilder, some other api i.e User Manager search. Map of parameters this should be in format of <String, String> or <String, String[]>
      limit - number of result on a page
      offset - offset/start of result
      Returns:
      SearchResult