Package com.logicaldoc.core.searchengine
Interface SearchEngine
- All Known Implementing Classes:
- StandardSearchEngine
public interface SearchEngine
Model of a search engine with search and I/O capabilities. Various
 implementations can be provided, and the configuration property
 searchengine must qualify the concrete implementation to use.
- Since:
- 6.5
- Author:
- Marco Meschieri - LogicalDOC
- 
Method SummaryModifier 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 indexvoidunlock()This method can unlock a locked index.
- 
Method Details- 
addHitAdds a new Hit into the index- Parameters:
- document- The document to add into the index
- content- The extracted body text
- Throws:
- IndexException- is an error happens and the document cannot be added to the index
 
- 
addHitAdds a new hit to the index- Parameters:
- document- The document that we want to add
- content- Stream of the document's file
- Throws:
- IndexException- is an error happens and the document cannot be added to the index
 
- 
optimizevoid optimize()Launch the index optimization that physically deletes the removed entries. This is a long running operation.
- 
checkString check()Launch the check on the Index- Returns:
- the output of the check
 
- 
deleteHitvoid deleteHit(long id) Deletes an hit in the index of the search engine.- Parameters:
- id- - id of the hit
 
- 
deleteHitsRemoved all passed hits from the index- Parameters:
- ids- Collection of hit identifiers
 
- 
getHit
- 
searchSearch for hits.
 Attention: The hits will be populated with just the fields stored in the index- Parameters:
- expression- the search expression
- filters- a set of filter expressions, optional
- expressionLanguage- the language in which the- expressionis writted
- rows- maximum number elements to be returned
- Returns:
- the hits ordered by descending score
 
- 
queryExecutes a low-level query in the fulltext index
 Attention: The hits will be populated with just the fields stored in the index- Parameters:
- expression- the query to use
- page- the page to retrieve
- size- the maximum number of entries to retrieve
- Returns:
- the search result, ordered by ascending id
 
- 
unlockvoid unlock()This method can unlock a locked index.
- 
isLockedboolean isLocked()Check if at least one index is locked- Returns:
- true if one or more indexes are locked
 
- 
getCountlong getCount()Returns the number of indexed documents in all indexes. Used for statistical output.- Returns:
- the total number of entries in the index
 
- 
dropIndexvoid dropIndex()Drops the full-text index
- 
purgelong purge()Removes from the index those entries without a coutnerpart in the database- Returns:
- number of deleted entries
 
- 
init@PostConstruct void init()To be called on the context startup, this method creates all indexes and unlock the existing ones
- 
close@PreDestroy void close()Closes all indexing operations, shuts down the engine.
- 
getServerObject getServer()Service method to get access from the internal core- Returns:
- the search server representation
 
 
-