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 Summary
Modifier and TypeMethodDescriptionvoid
addHit
(Document document, InputStream content) Adds a new hit to the indexvoid
Adds a new Hit into the indexcheck()
Launch the check on the Indexvoid
close()
Closes all indexing operations, shuts down the engine.void
deleteHit
(long id) Deletes an hit in the index of the search engine.void
deleteHits
(Collection<Long> ids) Removed all passed hits from the indexvoid
Drops the full-text indexlong
getCount()
Returns the number of indexed documents in all indexes.getHit
(long id) Service method to get access from the internal corevoid
init()
To be called on the context startup, this method creates all indexes and unlock the existing onesboolean
isLocked()
Check if at least one index is lockedvoid
optimize()
Launch the index optimization that physically deletes the removed entries.long
purge()
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 indexvoid
unlock()
This method can unlock a locked index.
-
Method Details
-
addHit
Adds a new Hit into the index- 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
Adds a new hit to the index- Parameters:
content
- Stream of the document's filedocument
- The document that we want to add- Throws:
IndexException
- is an error happens and the document cannot be added to the index
-
optimize
void optimize()Launch the index optimization that physically deletes the removed entries. This is a long running operation. -
check
String check()Launch the check on the Index- Returns:
- the output of the check
-
deleteHit
void deleteHit(long id) Deletes an hit in the index of the search engine.- Parameters:
id
- - id of the hit
-
deleteHits
Removed all passed hits from the index- Parameters:
ids
- Collection of hit identifiers
-
getHit
-
search
Search for hits.
Attention: The hits will be populated with just the fields stored in the index- Parameters:
expression
- the search expressionfilters
- a set of filter expressions, optionalexpressionLanguage
- the language in which theexpression
is writtedrows
- maximum number elements to be returned- Returns:
- the hits ordered by descending score
-
query
Executes 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 usepage
- the page to retrievesize
- the maximum number of entries to retrieve- Returns:
- the search result, ordered by ascending id
-
close
void close()Closes all indexing operations, shuts down the engine. -
unlock
void unlock()This method can unlock a locked index. -
isLocked
boolean isLocked()Check if at least one index is locked- Returns:
- true if one or more indexes are locked
-
getCount
long getCount()Returns the number of indexed documents in all indexes. Used for statistical output.- Returns:
- the total number of entries in the index
-
dropIndex
void dropIndex()Drops the full-text index -
purge
long purge()Removes from the index those entries without a coutnerpart in the database- Returns:
- number of deleted entries
-
init
void init()To be called on the context startup, this method creates all indexes and unlock the existing ones -
getServer
Object getServer()Service method to get access from the internal core- Returns:
- the search server representation
-