Package org.eclipse.rdf4j.sail.lucene
Interface SearchIndex
-
- All Known Implementing Classes:
AbstractLuceneIndex,AbstractSearchIndex
public interface SearchIndexA SearchIndex is a one-stop-shop abstraction of a Lucene index. It takes care of proper synchronization of IndexReaders, IndexWriters and IndexSearchers in a way that is suitable for a LuceneSail.- See Also:
LuceneSail
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaccept(Literal literal)Returns whether the provided literal is accepted by the LuceneIndex to be indexed.voidaddDocuments(Resource subject, java.util.List<Statement> statements)Add a complete Lucene Document based on these statements.Do not search for an existing document with the same subject id.voidaddRemoveStatements(java.util.Collection<Statement> added, java.util.Collection<Statement> removed)Add many statements at the same time, remove many statements at the same time.Ordering by resource has to be done inside this method.voidaddStatement(Statement statement)Indexes the specified Statement.This should be called from within a begin-commit-rollback block.voidbegin()Begins a transaction.voidclear()Clears the indexes.voidclearContexts(Resource... contexts)This should be called from within a begin-commit-rollback block.voidcommit()Commits any changes done to the LuceneIndex since the last commit.The semantics is synchronous to SailConnection.commit(), i.e.java.util.Collection<BindingSet>evaluate(SearchQueryEvaluator query)java.util.Map<IRI,java.util.Set<IRI>>getIndexedTypeMapping()voidinitialize(java.util.Properties parameters)booleanisGeoField(java.lang.String propertyName)Returns true if the given property contains a geometry.booleanisIndexedTypeStatement(Statement statement)Returns true if the given statement is a type statement of the right type, seeLuceneSail.INDEXEDTYPESto use.booleanisTypeFilteringEnabled()is theLuceneSail.INDEXEDTYPESparameter set for this index.booleanisTypeStatement(Statement statement)Returns true if the given statement is a type statement, seeLuceneSail.INDEXEDTYPESto use.voidremoveStatement(Statement statement)Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollbackvoidrollback()voidshutDown()
-
-
-
Method Detail
-
initialize
void initialize(java.util.Properties parameters) throws java.lang.Exception- Throws:
java.lang.Exception
-
evaluate
java.util.Collection<BindingSet> evaluate(SearchQueryEvaluator query) throws SailException
- Throws:
SailException
-
shutDown
void shutDown() throws java.io.IOException- Throws:
java.io.IOException
-
accept
boolean accept(Literal literal)
Returns whether the provided literal is accepted by the LuceneIndex to be indexed. It for instance does not make much since to index xsd:float.- Parameters:
literal- the literal to be accepted- Returns:
- true if the given literal will be indexed by this LuceneIndex
-
isGeoField
boolean isGeoField(java.lang.String propertyName)
Returns true if the given property contains a geometry.- Parameters:
propertyName-- Returns:
- boolean
-
isTypeStatement
boolean isTypeStatement(Statement statement)
Returns true if the given statement is a type statement, seeLuceneSail.INDEXEDTYPESto use. This method should return false ifisTypeFilteringEnabled()returns false.- Parameters:
statement- statement- Returns:
- boolean
-
isTypeFilteringEnabled
boolean isTypeFilteringEnabled()
is theLuceneSail.INDEXEDTYPESparameter set for this index.- Returns:
- boolean
-
isIndexedTypeStatement
boolean isIndexedTypeStatement(Statement statement)
Returns true if the given statement is a type statement of the right type, seeLuceneSail.INDEXEDTYPESto use. This method should return false ifisTypeFilteringEnabled()returns false.- Parameters:
statement- statement- Returns:
- boolean
-
getIndexedTypeMapping
java.util.Map<IRI,java.util.Set<IRI>> getIndexedTypeMapping()
- Returns:
- the accepted types for a particular predicate map (predicate -> [objects])
-
begin
void begin() throws java.io.IOExceptionBegins a transaction.- Throws:
java.io.IOException
-
commit
void commit() throws java.io.IOExceptionCommits any changes done to the LuceneIndex since the last commit.The semantics is synchronous to SailConnection.commit(), i.e. the LuceneIndex should be committed/rolled back whenever the LuceneSailConnection is committed/rolled back.- Throws:
java.io.IOException
-
rollback
void rollback() throws java.io.IOException- Throws:
java.io.IOException
-
addStatement
void addStatement(Statement statement) throws java.io.IOException
Indexes the specified Statement.This should be called from within a begin-commit-rollback block.- Parameters:
statement-- Throws:
java.io.IOException
-
removeStatement
void removeStatement(Statement statement) throws java.io.IOException
Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollbackblock.
- Parameters:
statement-- Throws:
java.io.IOException
-
addRemoveStatements
void addRemoveStatements(java.util.Collection<Statement> added, java.util.Collection<Statement> removed) throws java.io.IOException
Add many statements at the same time, remove many statements at the same time.Ordering by resource has to be done inside this method. The passed added/removed sets are disjunct, no statement can be in both. This should be called from within a begin-commit-rollback block.- Parameters:
added- all added statements, can have multiple subjectsremoved- all removed statements, can have multiple subjects- Throws:
java.io.IOException
-
clearContexts
void clearContexts(Resource... contexts) throws java.io.IOException
This should be called from within a begin-commit-rollback block.- Parameters:
contexts-- Throws:
java.io.IOException
-
addDocuments
void addDocuments(Resource subject, java.util.List<Statement> statements) throws java.io.IOException
Add a complete Lucene Document based on these statements.Do not search for an existing document with the same subject id. (assume the existing document was deleted). This should be called from within a begin-commit-rollback block.- Parameters:
subject-statements- the statements that make up the resource- Throws:
java.io.IOException
-
clear
void clear() throws java.io.IOExceptionClears the indexes.- Throws:
java.io.IOException
-
-