Class UnifiedSearchService

  • All Implemented Interfaces:
    org.exoplatform.services.rest.resource.ResourceContainer, org.picocontainer.Startable

    public class UnifiedSearchService
    extends Object
    implements org.exoplatform.services.rest.resource.ResourceContainer, org.picocontainer.Startable
    This class provides RESTful services endpoints which will help all external components to call unified search functions. These services include Search, Registry, Sites, Search settings, Quick search settings, and Enable search type.
    • Constructor Detail

      • UnifiedSearchService

        public UnifiedSearchService​(org.exoplatform.commons.api.search.SearchService searchService,
                                    org.exoplatform.commons.api.settings.SettingService settingService,
                                    org.exoplatform.portal.config.UserPortalConfigService userPortalConfigService,
                                    org.exoplatform.web.WebAppController webAppController)
        A constructor creates a instance of unified search service with the specified parameters
        Parameters:
        searchService - a service to work with other connectors
        settingService - a service to store and get the setting values
        userPortalConfigService - a service to get user information from portal
        webAppController - a controller to get configuration path
        eXo level API
        Experimental
    • Method Detail

      • start

        public void start()
        Specified by:
        start in interface org.picocontainer.Startable
      • stop

        public void stop()
        Specified by:
        stop in interface org.picocontainer.Startable
      • REST_search

        public javax.ws.rs.core.Response REST_search​(@Context
                                                     javax.ws.rs.core.UriInfo uriInfo,
                                                     String query,
                                                     String sSites,
                                                     String sTypes,
                                                     String sOffset,
                                                     String sLimit,
                                                     String sort,
                                                     String order,
                                                     String lang)
        Searches for a query.
        Parameters:
        uriInfo - Search context
        query - Searches for a query which is entered by the user.
        sSites - Searches in the specified sites only (for example, ACME or Intranet).
        sTypes - Searches for these specified content types only (for example, people, discussions, events, tasks, wikis, spaces, files, and documents).
        sOffset - Starts the offset of the results set.
        sLimit - Limit the maximum size of the results set.
        sort - Defines the Sort type (relevancy, date, title).
        order - Defines the Sort order (ascending, descending).
        Returns:
        a map of connectors, including their search results.
        eXo level API
        Experimental
      • REST_getRegistry

        public javax.ws.rs.core.Response REST_getRegistry()
        Gets all connectors which are registered in the system and are enabled.
        Returns:
        List of connectors and names of the enabled ones.
        eXo level API
        Experimental
      • REST_getSites

        public javax.ws.rs.core.Response REST_getSites()
        Gets all available sites in the system.
        Returns:
        a list of site names
        eXo level API
        Experimental
      • REST_getSearchSetting

        public javax.ws.rs.core.Response REST_getSearchSetting()
        Gets current user's search settings.
        Returns:
        search settings of the current logging in (or anonymous) user
        eXo level API
        Experimental
      • REST_setSearchSetting

        @RolesAllowed("administrators")
        public javax.ws.rs.core.Response REST_setSearchSetting​(long resultsPerPage,
                                                               String searchTypes,
                                                               boolean searchCurrentSiteOnly,
                                                               boolean hideSearchForm,
                                                               boolean hideFacetsFilter)
        Saves current user's search settings.
        Returns:
        "ok" when succeed
        eXo level API
        Experimental
      • REST_getQuicksearchSetting

        public javax.ws.rs.core.Response REST_getQuicksearchSetting()
        Gets current user's quick search settings.
        Returns:
        quick search settings of the current logging in user
        eXo level API
        Experimental
      • REST_setQuicksearchSetting

        public javax.ws.rs.core.Response REST_setQuicksearchSetting​(long resultsPerPage,
                                                                    String searchTypes,
                                                                    boolean searchCurrentSiteOnly)
        Saves current user's quick search settings.
        Returns:
        "ok" when succeed
        eXo level API
        Experimental
      • getEnabledSearchTypes

        public static List<String> getEnabledSearchTypes()
      • REST_setEnabledSearchtypes

        public javax.ws.rs.core.Response REST_setEnabledSearchtypes​(String searchTypes)
        Sets the "enabledSearchTypes" variable in a global context.
        Parameters:
        searchTypes - List of search types in the form of a comma-separated string.
        Returns:
        "ok" if the caller's role is administrator, otherwise, returns "nok: administrators only".
        eXo level API
        Experimental