Package org.sakaiproject.search.api
Interface SearchService
-
- All Superinterfaces:
Diagnosable
public interface SearchService extends Diagnosable
Provides a search interface- Author:
- ieb
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATE_STAMPstatic StringEVENT_SEARCHstatic StringEVENT_SEARCH_REFstatic StringEVENT_TRIGGER_INDEX_RELOADevent to trigger a reload of the search index by query nodesstatic StringEVENT_TRIGGER_SEARCHevent to trigger an update of the index sent from Search Service to index buildersstatic StringFIELD_CONTAINERSearch Field the container of the entitystatic StringFIELD_CONTENTSSearch Field (term vector, not full contents) The contents of the Entity Note the contents of the docuement are not stored in the index so theEntityContentProducergetContent method should be called to retrieve the contentstatic StringFIELD_CREATOR_DISPLAY_NAMESearch index field for the entity creator's display name (where is was produced)static StringFIELD_CREATOR_IDSearch index field for the entity creator's user id (where is was produced)static StringFIELD_CREATOR_USER_NAMESearch index field for the entity creator's username (where is was produced)static StringFIELD_DIGEST_COUNTstatic StringFIELD_INDEXEDstatic StringFIELD_REFERENCESearch field The reference of the entitystatic StringFIELD_SITEIDSearch Index Field for the site id of the entity ( where is was produced)static StringFIELD_TITLESearch Field The title of the entitystatic StringFIELD_TOOLSearch Field The Name of the Tool that owns the entitystatic StringFIELD_TYPESearch Field The tool type of the entitystatic StringFIELD_URLSearch Index Field the url to the entitystatic StringREST_CHECKSUMstatic StringREST_CONTEXTSstatic StringREST_ENDstatic StringREST_STARTstatic StringREST_TERMSstatic StringREST_USERID
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidforceReload()Force a reload regardless of if the index has changedList<SearchBuilderItem>getAllSearchItems()get all the search items in the index (must be a lazy load list)StringgetDigestStoragePath()Get the storage location for Digested content.List<SearchBuilderItem>getGlobalMasterSearchItems()get the global master itemsSet<String>getIndexBuilderNames()longgetNDocs()get the number of documents in the search indexintgetPendingDocs()get the number of pending documents in the search indexList<SearchStatus>getSearchStatus()Get the status of the search engineStringgetSearchSuggestion(String searchString)Get a suggestion for spelling errors etcString[]getSearchSuggestions(String searchString, String currentSite, boolean allMySites)String[]getSearchSuggestions(String searchString, String currentSite, boolean allMySites, String indexBuilderName)Same asgetSearchSuggestions(String, String, boolean), but can specify the logical name of the index builder which should execute the search.ListgetSegmentInfo()List<SearchBuilderItem>getSiteMasterSearchItems()get the master itemf to sthe siteStringgetStatus()get the status of the search serviceTermFrequencygetTerms(int documentId)get the term vector for this document, where document is thebooleanisEnabled()booleanisSearchServer()SRCH-96 whether the current server is of search server or notvoidrebuildIndex(String indexBuilderName)Trigger a rebuild of the named indexvoidrebuildInstance()trigger a rebuild of the whole indexvoidrebuildSite(String currentSiteId)rebuild the current site onlyvoidrefreshIndex(String indexBuilderName)Trigger a refresh of the named indexvoidrefreshInstance()Trigger an refresh of the whole indexvoidrefreshSite(String currentSiteId)Refresh the current site onlyvoidregisterFunction(String function)Adds a function for the SearchService to respond to and route to the index builder.voidreload()When reload is called, the index should be reloadedbooleanremoveWorkerLock()force the removal of the worker lockSearchListsearch(String searchTerms, List<String> contexts, List<String> toolIds, int searchStart, int searchEnd)Perform a search, return results in a list.SearchListsearch(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String indexBuilderName)This is the same as standard search, but the caller can specify the logical name of the index builder which should execute the search.SearchListsearch(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String filterName, String sorterName)This is the same as standard search, but the caller can specify, by name, the index Filter and the index Sorter by name The Sorter and the Filter will be consulted during the search, and hence should not make massive demands on the framework, otherwise they will cripple the search performanceSearchListsearch(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String indexBuilderName, Map<String,String> additionalSearchInformation)This is the same as standard search, but the caller can specify the logical name of the index builder which should execute the search and pass a more complex information in the search Terms.org.opensearch.action.search.SearchResponsesearchResponse(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String indexBuilderName, Map<String,String> additionalSearchInformation)This is the same as standard search, but the caller can specify the logical name of the index builder which should execute the search and pass a more complex information in the search Terms.StringsearchXML(Map parameterMap)generates a block of XML representing the search results-
Methods inherited from interface org.sakaiproject.search.api.Diagnosable
disableDiagnostics, enableDiagnostics, hasDiagnostics
-
-
-
-
Field Detail
-
REST_USERID
static final String REST_USERID
- See Also:
- Constant Field Values
-
REST_TERMS
static final String REST_TERMS
- See Also:
- Constant Field Values
-
REST_CHECKSUM
static final String REST_CHECKSUM
- See Also:
- Constant Field Values
-
REST_CONTEXTS
static final String REST_CONTEXTS
- See Also:
- Constant Field Values
-
REST_START
static final String REST_START
- See Also:
- Constant Field Values
-
REST_END
static final String REST_END
- See Also:
- Constant Field Values
-
EVENT_TRIGGER_SEARCH
static final String EVENT_TRIGGER_SEARCH
event to trigger an update of the index sent from Search Service to index builders- See Also:
- Constant Field Values
-
EVENT_TRIGGER_INDEX_RELOAD
static final String EVENT_TRIGGER_INDEX_RELOAD
event to trigger a reload of the search index by query nodes- See Also:
- Constant Field Values
-
EVENT_SEARCH
static final String EVENT_SEARCH
- See Also:
- Constant Field Values
-
EVENT_SEARCH_REF
static final String EVENT_SEARCH_REF
- See Also:
- Constant Field Values
-
FIELD_SITEID
static final String FIELD_SITEID
Search Index Field for the site id of the entity ( where is was produced)- See Also:
- Constant Field Values
-
FIELD_CREATOR_DISPLAY_NAME
static final String FIELD_CREATOR_DISPLAY_NAME
Search index field for the entity creator's display name (where is was produced)- See Also:
- Constant Field Values
-
FIELD_CREATOR_ID
static final String FIELD_CREATOR_ID
Search index field for the entity creator's user id (where is was produced)- See Also:
- Constant Field Values
-
FIELD_CREATOR_USER_NAME
static final String FIELD_CREATOR_USER_NAME
Search index field for the entity creator's username (where is was produced)- See Also:
- Constant Field Values
-
FIELD_URL
static final String FIELD_URL
Search Index Field the url to the entity- See Also:
- Constant Field Values
-
FIELD_TOOL
static final String FIELD_TOOL
Search Field The Name of the Tool that owns the entity- See Also:
- Constant Field Values
-
FIELD_TITLE
static final String FIELD_TITLE
Search Field The title of the entity- See Also:
- Constant Field Values
-
FIELD_CONTENTS
static final String FIELD_CONTENTS
Search Field (term vector, not full contents) The contents of the Entity Note the contents of the docuement are not stored in the index so theEntityContentProducergetContent method should be called to retrieve the content- See Also:
- Constant Field Values
-
FIELD_TYPE
static final String FIELD_TYPE
Search Field The tool type of the entity- See Also:
- Constant Field Values
-
FIELD_CONTAINER
static final String FIELD_CONTAINER
Search Field the container of the entity- See Also:
- Constant Field Values
-
FIELD_REFERENCE
static final String FIELD_REFERENCE
Search field The reference of the entity- See Also:
- Constant Field Values
-
FIELD_DIGEST_COUNT
static final String FIELD_DIGEST_COUNT
- See Also:
- Constant Field Values
-
DATE_STAMP
static final String DATE_STAMP
- See Also:
- Constant Field Values
-
FIELD_INDEXED
static final String FIELD_INDEXED
- See Also:
- Constant Field Values
-
-
Method Detail
-
search
SearchList search(String searchTerms, List<String> contexts, List<String> toolIds, int searchStart, int searchEnd) throws InvalidSearchQueryException
Perform a search, return results in a list.- Parameters:
searchTerms- the search termscontexts- a list of contexts in which to perform the searchsearchEnd-searchStart-- Returns:
- Throws:
InvalidSearchQueryException- if unable to parse the query
-
search
SearchList search(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String filterName, String sorterName) throws InvalidSearchQueryException
This is the same as standard search, but the caller can specify, by name, the index Filter and the index Sorter by name The Sorter and the Filter will be consulted during the search, and hence should not make massive demands on the framework, otherwise they will cripple the search performance- Parameters:
searchTerms- A search stringcontexts- A list of contextsstart- starting fromend- ending atfilterName- a lucene filtersorterName- a lucene sorter- Returns:
- Throws:
InvalidSearchQueryException- if unable to parse the query
-
search
SearchList search(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String indexBuilderName) throws InvalidSearchQueryException
This is the same as standard search, but the caller can specify the logical name of the index builder which should execute the search.- Parameters:
searchTerms- A search stringcontexts- A list of contextsstart- starting fromend- ending atindexBuilderName- logical index builder name ornullto fall back to default- Returns:
- Throws:
InvalidSearchQueryException- if unable to parse the query
-
search
SearchList search(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String indexBuilderName, Map<String,String> additionalSearchInformation) throws InvalidSearchQueryException
This is the same as standard search, but the caller can specify the logical name of the index builder which should execute the search and pass a more complex information in the search Terms.- Parameters:
searchTerms- A Map where we can define more information for the searchcontexts- A list of contextsstart- starting fromend- ending atindexBuilderName- logical index builder name ornullto fall back to defaultadditionalSearchInformation- extra parameters to construct more advanced queries- Returns:
- Throws:
InvalidSearchQueryException- if unable to parse the query
-
searchResponse
org.opensearch.action.search.SearchResponse searchResponse(String searchTerms, List<String> contexts, List<String> toolIds, int start, int end, String indexBuilderName, Map<String,String> additionalSearchInformation) throws InvalidSearchQueryException
This is the same as standard search, but the caller can specify the logical name of the index builder which should execute the search and pass a more complex information in the search Terms. In this case we return the SearchResponse directly- Parameters:
searchTerms- A Map where we can define more information for the searchcontexts- A list of contextsstart- starting fromend- ending atindexBuilderName- logical index builder name ornullto fall back to defaultadditionalSearchInformation- extra parameters to construct more advanced queries- Returns:
- Throws:
InvalidSearchQueryException- if unable to parse the query
-
registerFunction
void registerFunction(String function)
Adds a function for the SearchService to respond to and route to the index builder. EntityProducers that want their content to be searched, should register the events that indicate new data to this- Parameters:
function-
-
reload
void reload()
When reload is called, the index should be reloaded
-
refreshInstance
void refreshInstance()
Trigger an refresh of the whole index
-
refreshIndex
void refreshIndex(String indexBuilderName)
Trigger a refresh of the named index- Parameters:
indexBuilderName- the name of the index to refresh
-
rebuildInstance
void rebuildInstance()
trigger a rebuild of the whole index
-
rebuildIndex
void rebuildIndex(String indexBuilderName)
Trigger a rebuild of the named index- Parameters:
indexBuilderName- the name of the index to rebuild
-
refreshSite
void refreshSite(String currentSiteId)
Refresh the current site only- Parameters:
currentSiteId-
-
rebuildSite
void rebuildSite(String currentSiteId)
rebuild the current site only- Parameters:
currentSiteId-
-
getStatus
String getStatus()
get the status of the search service- Returns:
-
getNDocs
long getNDocs()
get the number of documents in the search index- Returns:
-
getPendingDocs
int getPendingDocs()
get the number of pending documents in the search index- Returns:
-
getAllSearchItems
List<SearchBuilderItem> getAllSearchItems()
get all the search items in the index (must be a lazy load list)- Returns:
-
getSiteMasterSearchItems
List<SearchBuilderItem> getSiteMasterSearchItems()
get the master itemf to sthe site- Returns:
-
getGlobalMasterSearchItems
List<SearchBuilderItem> getGlobalMasterSearchItems()
get the global master items- Returns:
-
getSearchStatus
List<SearchStatus> getSearchStatus()
Get the status of the search engine- Returns:
-
removeWorkerLock
boolean removeWorkerLock()
force the removal of the worker lock- Returns:
-
getSegmentInfo
List getSegmentInfo()
-
forceReload
void forceReload()
Force a reload regardless of if the index has changed
-
getTerms
TermFrequency getTerms(int documentId) throws IOException
get the term vector for this document, where document is the- Parameters:
documentId-- Returns:
- Throws:
IOException
-
searchXML
String searchXML(Map parameterMap)
generates a block of XML representing the search results- Parameters:
parameterMap-- Returns:
-
isEnabled
boolean isEnabled()
- Returns:
-
getDigestStoragePath
String getDigestStoragePath()
Get the storage location for Digested content. Will return null if system is Not set up to store content on the fs- Returns:
-
getSearchSuggestion
String getSearchSuggestion(String searchString)
Get a suggestion for spelling errors etc- Parameters:
searchString-- Returns:
- a suggestion
-
getSearchSuggestions
String[] getSearchSuggestions(String searchString, String currentSite, boolean allMySites)
-
getSearchSuggestions
String[] getSearchSuggestions(String searchString, String currentSite, boolean allMySites, String indexBuilderName)
Same asgetSearchSuggestions(String, String, boolean), but can specify the logical name of the index builder which should execute the search.- Parameters:
searchString- the search termscurrentSite- the user's current site. Will search only this site if notnullandallMySitesis falseallMySites- if true, will search all of the current user's sitesindexBuilderName- logical index builder name ornullto fall back to default- Returns:
-
isSearchServer
boolean isSearchServer()
SRCH-96 whether the current server is of search server or not- Returns:
-
-