Class LuceneIndexNIOFS
java.lang.Object
org.eclipse.rdf4j.sail.lucene.AbstractSearchIndex
org.eclipse.rdf4j.sail.lucene.AbstractLuceneIndex
org.eclipse.rdf4j.sail.lucene.impl.LuceneIndex
org.eclipse.rdf4j.sail.lucene.impl.LuceneIndexNIOFS
- All Implemented Interfaces:
SearchIndex
LuceneIndex which uses a NIOFSDirectory instead of MMapDirectory to avoid the JVM crash (see
http://
stackoverflow.com/questions/8224843/jvm-crashes-on-lucene-datainput- readvint).
- Author:
- andriy.nikolov
-
Field Summary
Fields inherited from class LuceneIndex
currentMonitorModifier and TypeFieldDescriptionprotected ReaderMonitorThis holds IndexReader and IndexSearcher.Fields inherited from class AbstractLuceneIndex
oldmonitorsModifier and TypeFieldDescriptionprotected final Collection<AbstractReaderMonitor> keep a lit of old monitors that are still iterating but not closed (open iterators), will be all closed on shutdown items are removed from list by ReaderMnitor.endReading() when closingFields inherited from class AbstractSearchIndex
defaultNumDocs, maxDocs, wktFieldsModifier and TypeFieldDescriptionprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.store.DirectorycreateDirectory(Properties parameters) Methods inherited from class LuceneIndex
addContextField, addDocument, addIDField, addPredicateField, addResourceField, addStoredOnlyPredicateField, addTextField, begin, clear, clearContexts, commit, copyDocument, createAnalyzer, createQueryAnalyzer, createSimilarity, createSpatialStrategyMapper, deleteDocument, geoQuery, geoRelationQuery, getAnalyzer, getCurrentMonitor, getDirectory, getDocument, getDocument, getDocument, getDocuments, getDocuments, getIndexReader, getIndexSearcher, getIndexWriter, getSnippet, getSpatialContext, getSpatialStrategyMapper, initialize, newBulkUpdate, newDocument, query, rollback, search, search, search, search, shutDown, updateDocumentModifier and TypeMethodDescriptionstatic voidaddContextField(String context, org.apache.lucene.document.Document document) Add the "context" value to the docprotected voidstatic voidaddIDField(String id, org.apache.lucene.document.Document document) Stores and indexes an ID in a Document.static voidaddPredicateField(String predicate, String text, org.apache.lucene.document.Document document) static voidaddResourceField(String resourceId, org.apache.lucene.document.Document document) Stores and indexes the resource ID in a Document.static voidaddStoredOnlyPredicateField(String predicate, String text, org.apache.lucene.document.Document document) static voidaddTextField(String text, org.apache.lucene.document.Document document) 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.protected SearchDocumentprotected org.apache.lucene.analysis.AnalyzercreateAnalyzer(Properties parameters) protected org.apache.lucene.analysis.AnalyzercreateQueryAnalyzer(Properties parameters) protected org.apache.lucene.search.similarities.SimilaritycreateSimilarity(Properties parameters) protected com.google.common.base.Function<String, ? extends org.apache.lucene.spatial.SpatialStrategy> createSpatialStrategyMapper(Map<String, String> parameters) protected voidprotected Iterable<? extends DocumentDistance> geoQuery(IRI geoProperty, org.locationtech.spatial4j.shape.Point p, IRI units, double distance, String distanceVar, Var contextVar) protected Iterable<? extends DocumentResult> geoRelationQuery(String relation, IRI geoProperty, String wkt, Var contextVar) org.apache.lucene.analysis.AnalyzerCurrent monitor holds instance of IndexReader and IndexSearcher It is used to keep track of readersorg.apache.lucene.store.Directoryorg.apache.lucene.document.DocumentgetDocument(int docId, Set<String> fieldsToLoad) Returns the lucene hit with the given id of the respective lucene queryprotected SearchDocumentgetDocument(String id) org.apache.lucene.document.DocumentgetDocument(Resource subject, Resource context) Returns a Document representing the specified Resource and Context combination, or null when no such Document exists yet.protected Iterable<? extends SearchDocument> getDocuments(String resourceId) List<org.apache.lucene.document.Document> getDocuments(Resource subject) Returns a list of Documents representing the specified Resource (empty when no such Document exists yet).Each document represent a set of statements with the specified Resource as a subject, which are stored in a specific contextorg.apache.lucene.index.IndexReaderorg.apache.lucene.search.IndexSearcherorg.apache.lucene.index.IndexWritergetSnippet(String fieldName, String text, org.apache.lucene.search.highlight.Highlighter highlighter) protected org.locationtech.spatial4j.context.SpatialContextgetSpatialContext(String property) com.google.common.base.Function<? super String, ? extends org.apache.lucene.spatial.SpatialStrategy> voidinitialize(Properties parameters) protected BulkUpdaterprotected SearchDocumentnewDocument(String id, String resourceId, String context) protected Iterable<? extends DocumentScore> Parse the passed query.voidrollback()org.apache.lucene.search.TopDocssearch(org.apache.lucene.search.Query query) Evaluates the given query and returns the results as a TopDocs instance.org.apache.lucene.search.TopDocssearch(org.apache.lucene.search.Query query, int numDocs) Evaluates the given query and returns the results as a TopDocs instance.org.apache.lucene.search.TopDocsEvaluates the given query only for the given resource.org.apache.lucene.search.TopDocsEvaluates the given query only for the given resource.voidshutDown()protected voidMethods inherited from class AbstractLuceneIndex
getOldMonitorsMethods inherited from class AbstractSearchIndex
accept, addDocuments, addRemoveStatements, addStatement, evaluate, getIndexedTypeMapping, getResource, isGeoField, isIndexedTypeStatement, isTypeFilteringEnabled, isTypeStatement, parseLuceneQueryShape, parseQueryPoint, parseQueryShape, removeStatementModifier and TypeMethodDescriptionbooleanReturns whether the provided literal is accepted by the LuceneIndex to be indexed.final voidaddDocuments(Resource subject, List<Statement> statements) Add a complete Lucene Document based on these statements.final voidaddRemoveStatements(Collection<Statement> added, Collection<Statement> removed) Add many statements at the same time, remove many statements at the same time.final voidaddStatement(Statement statement) Indexes the specified Statement.final Collection<BindingSet> evaluate(SearchQueryEvaluator evaluator) protected ResourcegetResource(SearchDocument document) Returns the Resource corresponding with the specified Document.booleanisGeoField(String fieldName) 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.booleanis theLuceneSail.INDEXEDTYPESparameter set for this index.booleanisTypeStatement(Statement statement) Returns true if the given statement is a type statement, seeLuceneSail.INDEXEDTYPESto use.protected ObjectparseLuceneQueryShape(String property, String value) protected org.locationtech.spatial4j.shape.ShapeparseQueryPoint(String property, String value) protected org.locationtech.spatial4j.shape.ShapeparseQueryShape(String property, String value) final voidremoveStatement(Statement statement) Removes the specified Statement from the indexes.This should be called from within a begin-commit-rollback
-
Constructor Details
-
LuceneIndexNIOFS
public LuceneIndexNIOFS()
-
-
Method Details
-
createDirectory
protected org.apache.lucene.store.Directory createDirectory(Properties parameters) throws IOException - Overrides:
createDirectoryin classLuceneIndex- Throws:
IOException
-