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
-
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
setConfig
(ContextProperties config) void
setDocumentDao
(DocumentDAO documentDao) void
setNoteDao
(DocumentNoteDAO noteDao) void
unlock()
This method can unlock a locked index.
-
Field Details
-
VERSION
public static org.apache.lucene.util.Version VERSION
-
-
Method Details
-
setConfig
-
setDocumentDao
-
addHit
Description copied from interface:SearchEngine
Adds a new Hit into the index- Specified by:
addHit
in 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:SearchEngine
Adds a new hit to the index- Specified by:
addHit
in 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:SearchEngine
Launch the index optimization that physically deletes the removed entries. This is a long running operation.- Specified by:
optimize
in interfaceSearchEngine
-
check
Description copied from interface:SearchEngine
Launch the check on the Index- Specified by:
check
in interfaceSearchEngine
- Returns:
- the output of the check
-
deleteHit
public void deleteHit(long id) Description copied from interface:SearchEngine
Deletes an hit in the index of the search engine.- Specified by:
deleteHit
in interfaceSearchEngine
- Parameters:
id
- - id of the hit
-
deleteHits
Description copied from interface:SearchEngine
Removed all passed hits from the index- Specified by:
deleteHits
in interfaceSearchEngine
- Parameters:
ids
- Collection of hit identifiers
-
getHit
- Specified by:
getHit
in interfaceSearchEngine
-
query
Description copied from interface:SearchEngine
Executes a low-level query in the fulltext index
Attention: The hits will be populated with just the fields stored in the index- Specified by:
query
in 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:SearchEngine
Search for hits.
Attention: The hits will be populated with just the fields stored in the index- Specified by:
search
in interfaceSearchEngine
- 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
-
close
public void close()Description copied from interface:SearchEngine
Closes all indexing operations, shuts down the engine.- Specified by:
close
in interfaceSearchEngine
-
unlock
public void unlock()Description copied from interface:SearchEngine
This method can unlock a locked index.- Specified by:
unlock
in interfaceSearchEngine
-
isLocked
public boolean isLocked()Description copied from interface:SearchEngine
Check if at least one index is locked- Specified by:
isLocked
in interfaceSearchEngine
- Returns:
- true if one or more indexes are locked
-
getCount
public long getCount()Description copied from interface:SearchEngine
Returns the number of indexed documents in all indexes. Used for statistical output.- Specified by:
getCount
in interfaceSearchEngine
- Returns:
- the total number of entries in the index
- See Also:
-
purge
public long purge()Description copied from interface:SearchEngine
Removes from the index those entries without a coutnerpart in the database- Specified by:
purge
in interfaceSearchEngine
- Returns:
- number of deleted entries
-
dropIndex
public void dropIndex()Description copied from interface:SearchEngine
Drops the full-text index- Specified by:
dropIndex
in interfaceSearchEngine
- See Also:
-
init
public void init()Description copied from interface:SearchEngine
To be called on the context startup, this method creates all indexes and unlock the existing ones- Specified by:
init
in interfaceSearchEngine
- See Also:
-
getServer
Description copied from interface:SearchEngine
Service method to get access from the internal core- Specified by:
getServer
in interfaceSearchEngine
- Returns:
- the search server representation
-
setNoteDao
-