Package com.logicaldoc.core.searchengine
Class StandardSearchEngine
java.lang.Object
com.logicaldoc.core.searchengine.StandardSearchEngine
- All Implemented Interfaces:
SearchEngine
Standard implementation that implements a local search engine
- Since:
- 6.5
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHit(Document document, InputStream content) Adds a new hit to the indexvoidAdds a new Hit into the indexcheck()Launch the check on the Indexvoidclose()Closes all indexing operations, shuts down the engine.voiddeleteHit(long id) Deletes an hit in the index of the search engine.voiddeleteHits(Collection<Long> ids) Removed all passed hits from the indexvoidDrops the full-text indexlonggetCount()Returns the number of indexed documents in all indexes.getHit(long id) Service method to get access from the internal corevoidinit()To be called on the context startup, this method creates all indexes and unlock the existing onesbooleanisLocked()Check if at least one index is lockedvoidoptimize()Launch the index optimization that physically deletes the removed entries.longpurge()Removes from the index those entries without a coutnerpart in the databaseExecutes a low-level query in the fulltext index
Attention: The hits will be populated with just the fields stored in the indexSearch for hits.
Attention: The hits will be populated with just the fields stored in the indexvoidsetConfig(ContextProperties config) voidsetDocumentDao(DocumentDAO documentDao) voidsetNoteDao(DocumentNoteDAO noteDao) voidunlock()This method can unlock a locked index.
-
Field Details
-
VERSION
public static final org.apache.lucene.util.Version VERSION
-
-
Method Details
-
setConfig
-
setDocumentDao
-
addHit
Description copied from interface:SearchEngineAdds a new Hit into the index- Specified by:
addHitin interfaceSearchEngine- Parameters:
document- The document to add into the indexcontent- The extracted body text- Throws:
IndexException- is an error happens and the document cannot be added to the index
-
addHit
Description copied from interface:SearchEngineAdds a new hit to the index- Specified by:
addHitin interfaceSearchEngine- Parameters:
document- The document that we want to addcontent- Stream of the document's file- Throws:
IndexException- is an error happens and the document cannot be added to the index
-
optimize
public void optimize()Description copied from interface:SearchEngineLaunch the index optimization that physically deletes the removed entries. This is a long running operation.- Specified by:
optimizein interfaceSearchEngine
-
check
Description copied from interface:SearchEngineLaunch the check on the Index- Specified by:
checkin interfaceSearchEngine- Returns:
- the output of the check
-
deleteHit
public void deleteHit(long id) Description copied from interface:SearchEngineDeletes an hit in the index of the search engine.- Specified by:
deleteHitin interfaceSearchEngine- Parameters:
id- - id of the hit
-
deleteHits
Description copied from interface:SearchEngineRemoved all passed hits from the index- Specified by:
deleteHitsin interfaceSearchEngine- Parameters:
ids- Collection of hit identifiers
-
getHit
- Specified by:
getHitin interfaceSearchEngine
-
query
Description copied from interface:SearchEngineExecutes a low-level query in the fulltext index
Attention: The hits will be populated with just the fields stored in the index- Specified by:
queryin interfaceSearchEngine- Parameters:
expression- the query to usepage- the page to retrievesize- the maximum number of entries to retrieve- Returns:
- the search result, ordered by ascending id
-
search
Description copied from interface:SearchEngineSearch for hits.
Attention: The hits will be populated with just the fields stored in the index- Specified by:
searchin interfaceSearchEngine- Parameters:
expression- the search expressionfilters- a set of filter expressions, optionalexpressionLanguage- the language in which theexpressionis writtedrows- maximum number elements to be returned- Returns:
- the hits ordered by descending score
-
unlock
public void unlock()Description copied from interface:SearchEngineThis method can unlock a locked index.- Specified by:
unlockin interfaceSearchEngine
-
isLocked
public boolean isLocked()Description copied from interface:SearchEngineCheck if at least one index is locked- Specified by:
isLockedin interfaceSearchEngine- Returns:
- true if one or more indexes are locked
-
getCount
public long getCount()Description copied from interface:SearchEngineReturns the number of indexed documents in all indexes. Used for statistical output.- Specified by:
getCountin interfaceSearchEngine- Returns:
- the total number of entries in the index
- See Also:
-
purge
public long purge()Description copied from interface:SearchEngineRemoves from the index those entries without a coutnerpart in the database- Specified by:
purgein interfaceSearchEngine- Returns:
- number of deleted entries
-
dropIndex
public void dropIndex()Description copied from interface:SearchEngineDrops the full-text index- Specified by:
dropIndexin interfaceSearchEngine- See Also:
-
close
@PreDestroy public void close()Description copied from interface:SearchEngineCloses all indexing operations, shuts down the engine.- Specified by:
closein interfaceSearchEngine
-
init
@PostConstruct public void init()Description copied from interface:SearchEngineTo be called on the context startup, this method creates all indexes and unlock the existing ones- Specified by:
initin interfaceSearchEngine
-
getServer
Description copied from interface:SearchEngineService method to get access from the internal core- Specified by:
getServerin interfaceSearchEngine- Returns:
- the search server representation
-
setNoteDao
-