org.olat.search.service
Class SearchServiceImpl

java.lang.Object
  extended by org.olat.search.service.SearchServiceImpl
All Implemented Interfaces:
SearchService

public class SearchServiceImpl
extends java.lang.Object
implements SearchService

Author:
Christian Guretzki

Method Summary
 void addToIndex(org.apache.lucene.document.Document document)
          Add a document to existing index.
 void deleteFromIndex(org.apache.lucene.document.Document document)
          Delete a document in existing index.
 SearchResults doSearch(java.lang.String query, Identity identity, Roles roles, boolean doHighlighting)
           
 long getIndexInterval()
          Get index-interval of running system
static SearchService getInstance()
          Factory method to get an instance.
 SearchModuleConfig getSearchModuleConfig()
           
 SearchServiceStatus getStatus()
          Return current state of search service, Includes full-indexing, index and search.
 void init(SearchModuleConfig searchModuleConfig)
          Initializes service.
 boolean isLocal()
          since 6.0.3 the index creator and query executor must not be the same instance as running the LMS.
 void setIndexInterval(long indexInterval)
          Change index-interval of running system immediately to reduce system load.
 java.util.Set<java.lang.String> spellCheck(java.lang.String query)
          Check a query for similar words.
 void startIndexing()
          Start a new full index.
 void stop()
          Stop search service.
 void stopIndexing()
          Stop current full-indexing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SearchService getInstance()
Factory method to get an instance.

Returns:

doSearch

public SearchResults doSearch(java.lang.String query,
                              Identity identity,
                              Roles roles,
                              boolean doHighlighting)
                       throws ServiceNotAvailableException,
                              org.apache.lucene.queryParser.ParseException,
                              QueryException
Specified by:
doSearch in interface SearchService
Parameters:
query - Lucene query string
identity - Idenity of searching-user
roles - Roles of searching-user
doHighlighting - Highlights founded text fragements in result
Returns:
Search result for queury
Throws:
ServiceNotAvailableException
org.apache.lucene.queryParser.ParseException
QueryException

addToIndex

public void addToIndex(org.apache.lucene.document.Document document)
Description copied from interface: SearchService
Add a document to existing index.

Specified by:
addToIndex in interface SearchService
Parameters:
document - New document.

startIndexing

public void startIndexing()
Description copied from interface: SearchService
Start a new full index.

Specified by:
startIndexing in interface SearchService

stopIndexing

public void stopIndexing()
Description copied from interface: SearchService
Stop current full-indexing.

Specified by:
stopIndexing in interface SearchService

deleteFromIndex

public void deleteFromIndex(org.apache.lucene.document.Document document)
Description copied from interface: SearchService
Delete a document in existing index.

Specified by:
deleteFromIndex in interface SearchService
Parameters:
document - Delete this document.

init

public void init(SearchModuleConfig searchModuleConfig)
Description copied from interface: SearchService
Initializes service.

Specified by:
init in interface SearchService

getStatus

public SearchServiceStatus getStatus()
Description copied from interface: SearchService
Return current state of search service, Includes full-indexing, index and search.

Specified by:
getStatus in interface SearchService
Returns:

setIndexInterval

public void setIndexInterval(long indexInterval)
Description copied from interface: SearchService
Change index-interval of running system immediately to reduce system load. Overwrites the config parameter 'indexInterval'. The value will not be stored persistent and will be lost at next restart.

Specified by:
setIndexInterval in interface SearchService
Parameters:
indexInterval - New index-interval.

getIndexInterval

public long getIndexInterval()
Description copied from interface: SearchService
Get index-interval of running system

Specified by:
getIndexInterval in interface SearchService
Returns:
indexInterval

getSearchModuleConfig

public SearchModuleConfig getSearchModuleConfig()
Specified by:
getSearchModuleConfig in interface SearchService
Returns:
Resturn search module configuration.

spellCheck

public java.util.Set<java.lang.String> spellCheck(java.lang.String query)
                                           throws ServiceNotAvailableException
Description copied from interface: SearchService
Check a query for similar words.

Specified by:
spellCheck in interface SearchService
Returns:
List of similar words which exist in index.
Throws:
ServiceNotAvailableException
See Also:
org.olat.search.service.SearchService#spellCheck(java.lang.String)

stop

public void stop()
Description copied from interface: SearchService
Stop search service.

Specified by:
stop in interface SearchService

isLocal

public boolean isLocal()
Description copied from interface: SearchService
since 6.0.3 the index creator and query executor must not be the same instance as running the LMS. isLocal() returns true if the asking instance is responsible for creation of the index and doing queries, hence the administrative methods like start stop etc. can be called.

Specified by:
isLocal in interface SearchService
Returns:
See Also:
org.olat.search.service.SearchService#isLocal()