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 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
    • 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 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

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

        Resource getModuleConfiguration​(ResourceResolver resolver,
                                        java.lang.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

        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 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

        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 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,
                                           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 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,
                                  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 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