org.exoplatform.commons.search.service
Class UnifiedSearchService

java.lang.Object
  extended by org.exoplatform.commons.search.service.UnifiedSearchService
All Implemented Interfaces:
org.exoplatform.services.rest.resource.ResourceContainer

public class UnifiedSearchService
extends Object
implements org.exoplatform.services.rest.resource.ResourceContainer

This class provides end points help all external components call unified search service by Restful service standard. These services are search, search setting, quick search setting, registry, sites and enable search type


Constructor Summary
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
 
Method Summary
static List<String> getEnabledSearchTypes()
           
 javax.ws.rs.core.Response REST_getQuicksearchSetting()
          Get current user's setting for Quick search portlet
 javax.ws.rs.core.Response REST_getRegistry()
          Get all connectors registered in the system and which are enabled
 javax.ws.rs.core.Response REST_getSearchSetting()
          Get current user's setting for Search portlet
 javax.ws.rs.core.Response REST_getSites()
          Get all available sites in the system
 javax.ws.rs.core.Response REST_search(javax.ws.rs.core.UriInfo uriInfo, String query, String sSites, String sTypes, String sOffset, String sLimit, String sort, String order)
          Search for a query, with (optional) parameters (sites, content types...)
 javax.ws.rs.core.Response REST_setEnabledSearchtypes(String searchTypes)
          Set "enabledSearchTypes" global variable
 javax.ws.rs.core.Response REST_setQuicksearchSetting(long resultsPerPage, String searchTypes, boolean searchCurrentSiteOnly)
          Save current user's setting for Quick search portlet
 javax.ws.rs.core.Response REST_setSearchSetting(long resultsPerPage, String searchTypes, boolean searchCurrentSiteOnly, boolean hideSearchForm, boolean hideFacetsFilter)
          Save current user's setting for Search portlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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)
Search for a query, with (optional) parameters (sites, content types...)

Parameters:
context - Search context
query - The user-input query to search for
sites - Search on these specified sites only (e.g acme, intranet...)
types - Search for these specified content types only (e.g people, discussion, event, task, wiki, activity, social, file, document...)
offset - Start offset of the result set
limit - Maximum size of the result set
sort - Sort type (relevancy, date, title)
order - Sort order (asc, desc)
Returns:
a map of connector with their search result

REST_getRegistry

public javax.ws.rs.core.Response REST_getRegistry()
Get all connectors registered in the system and which are enabled

Returns:
List of connectors and names of the enabled ones (in JSON)

REST_getSites

public javax.ws.rs.core.Response REST_getSites()
Get all available sites in the system

Returns:
List of site names in JSON

REST_getSearchSetting

public javax.ws.rs.core.Response REST_getSearchSetting()
Get current user's setting for Search portlet

Returns:
Search setting of the current logging in (or anonymous) user

REST_setSearchSetting

public javax.ws.rs.core.Response REST_setSearchSetting(long resultsPerPage,
                                                       String searchTypes,
                                                       boolean searchCurrentSiteOnly,
                                                       boolean hideSearchForm,
                                                       boolean hideFacetsFilter)
Save current user's setting for Search portlet

Returns:
"ok" when succeed

REST_getQuicksearchSetting

public javax.ws.rs.core.Response REST_getQuicksearchSetting()
Get current user's setting for Quick search portlet

Returns:
Quick search setting of the current logging in user

REST_setQuicksearchSetting

public javax.ws.rs.core.Response REST_setQuicksearchSetting(long resultsPerPage,
                                                            String searchTypes,
                                                            boolean searchCurrentSiteOnly)
Save current user's setting for Quick search portlet

Returns:
"ok" when succeed

getEnabledSearchTypes

public static List<String> getEnabledSearchTypes()

REST_setEnabledSearchtypes

public javax.ws.rs.core.Response REST_setEnabledSearchtypes(String searchTypes)
Set "enabledSearchTypes" global variable

Parameters:
searchTypes - List of search types in the form of a comma-separated string
Returns:
Success if the caller's role is administrator, Failure otherwise


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.