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(org.eclipse.rdf4j.model.Literal literal)Returns whether the provided literal is accepted by the LuceneIndex to be indexed.voidaddDocuments(org.eclipse.rdf4j.model.Resource subject, List<org.eclipse.rdf4j.model.Statement> statements)Add a complete Lucene Document based on these statements.Do not search for an existing document with the same subject id.voidaddRemoveStatements(Collection<org.eclipse.rdf4j.model.Statement> added, Collection<org.eclipse.rdf4j.model.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(org.eclipse.rdf4j.model.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(org.eclipse.rdf4j.model.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.Collection<org.eclipse.rdf4j.query.BindingSet>evaluate(SearchQueryEvaluator query)Map<org.eclipse.rdf4j.model.IRI,Set<org.eclipse.rdf4j.model.IRI>>getIndexedTypeMapping()voidinitialize(Properties parameters)booleanisGeoField(String propertyName)Returns true if the given property contains a geometry.booleanisIndexedTypeStatement(org.eclipse.rdf4j.model.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(org.eclipse.rdf4j.model.Statement statement)Returns true if the given statement is a type statement, seeLuceneSail.INDEXEDTYPESto use.voidremoveStatement(org.eclipse.rdf4j.model.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(Properties parameters) throws Exception
- Throws:
Exception
-
evaluate
Collection<org.eclipse.rdf4j.query.BindingSet> evaluate(SearchQueryEvaluator query) throws SailException
- Throws:
SailException
-
shutDown
void shutDown() throws IOException- Throws:
IOException
-
accept
boolean accept(org.eclipse.rdf4j.model.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(String propertyName)
Returns true if the given property contains a geometry.- Parameters:
propertyName-- Returns:
- boolean
-
isTypeStatement
boolean isTypeStatement(org.eclipse.rdf4j.model.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(org.eclipse.rdf4j.model.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
Map<org.eclipse.rdf4j.model.IRI,Set<org.eclipse.rdf4j.model.IRI>> getIndexedTypeMapping()
- Returns:
- the accepted types for a particular predicate map (predicate -> [objects])
-
begin
void begin() throws IOExceptionBegins a transaction.- Throws:
IOException
-
commit
void commit() throws 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:
IOException
-
rollback
void rollback() throws IOException- Throws:
IOException
-
addStatement
void addStatement(org.eclipse.rdf4j.model.Statement statement) throws IOExceptionIndexes the specified Statement.This should be called from within a begin-commit-rollback block.- Parameters:
statement-- Throws:
IOException
-
removeStatement
void removeStatement(org.eclipse.rdf4j.model.Statement statement) throws IOExceptionRemoves the specified Statement from the indexes.This should be called from within a begin-commit-rollbackblock.
- Parameters:
statement-- Throws:
IOException
-
addRemoveStatements
void addRemoveStatements(Collection<org.eclipse.rdf4j.model.Statement> added, Collection<org.eclipse.rdf4j.model.Statement> removed) throws 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:
IOException
-
clearContexts
void clearContexts(org.eclipse.rdf4j.model.Resource... contexts) throws IOExceptionThis should be called from within a begin-commit-rollback block.- Parameters:
contexts-- Throws:
IOException
-
addDocuments
void addDocuments(org.eclipse.rdf4j.model.Resource subject, List<org.eclipse.rdf4j.model.Statement> statements) throws IOExceptionAdd 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:
IOException
-
clear
void clear() throws IOExceptionClears the indexes.- Throws:
IOException
-
-