Package org.apache.lucene.index
Class TrackingIndexWriter
- java.lang.Object
-
- org.apache.lucene.index.TrackingIndexWriter
-
public class TrackingIndexWriter extends java.lang.Object
Class that tracks changes to a delegated IndexWriter, used byControlledRealTimeReopenThread
to ensure specific changes are visible. Create this class (passing your IndexWriter), and then pass this class toControlledRealTimeReopenThread
. Be sure to make all changes via the TrackingIndexWriter, otherwiseControlledRealTimeReopenThread
won't know about the changes.
-
-
Constructor Summary
Constructors Constructor Description TrackingIndexWriter(IndexWriter writer)
Create aTrackingIndexWriter
wrapping the providedIndexWriter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addDocument(java.lang.Iterable<? extends IndexableField> d)
CallsIndexWriter.addDocument(Iterable)
and returns the generation that reflects this change.long
addDocument(java.lang.Iterable<? extends IndexableField> d, Analyzer a)
CallsIndexWriter.addDocument(Iterable,Analyzer)
and returns the generation that reflects this change.long
addDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs)
CallsIndexWriter.addDocuments(Iterable)
and returns the generation that reflects this change.long
addDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer a)
CallsIndexWriter.addDocuments(Iterable,Analyzer)
and returns the generation that reflects this change.long
addIndexes(IndexReader... readers)
CallsIndexWriter.addIndexes(IndexReader...)
and returns the generation that reflects this change.long
addIndexes(Directory... dirs)
CallsIndexWriter.addIndexes(Directory...)
and returns the generation that reflects this change.long
deleteAll()
CallsIndexWriter.deleteAll()
and returns the generation that reflects this change.long
deleteDocuments(Term t)
CallsIndexWriter.deleteDocuments(Term)
and returns the generation that reflects this change.long
deleteDocuments(Term... terms)
CallsIndexWriter.deleteDocuments(Term...)
and returns the generation that reflects this change.long
deleteDocuments(Query q)
CallsIndexWriter.deleteDocuments(Query)
and returns the generation that reflects this change.long
deleteDocuments(Query... queries)
CallsIndexWriter.deleteDocuments(Query...)
and returns the generation that reflects this change.long
getAndIncrementGeneration()
Return and increment current gen.long
getGeneration()
Return the current generation being indexed.IndexWriter
getIndexWriter()
Return the wrappedIndexWriter
.long
tryDeleteDocument(IndexReader reader, int docID)
CalsIndexWriter.tryDeleteDocument(IndexReader,int)
and returns the generation that reflects this change.long
updateDocument(Term t, java.lang.Iterable<? extends IndexableField> d)
CallsIndexWriter.updateDocument(Term,Iterable)
and returns the generation that reflects this change.long
updateDocument(Term t, java.lang.Iterable<? extends IndexableField> d, Analyzer a)
CallsIndexWriter.updateDocument(Term,Iterable,Analyzer)
and returns the generation that reflects this change.long
updateDocuments(Term t, java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs)
CallsIndexWriter.updateDocuments(Term,Iterable)
and returns the generation that reflects this change.long
updateDocuments(Term t, java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer a)
CallsIndexWriter.updateDocuments(Term,Iterable,Analyzer)
and returns the generation that reflects this change.
-
-
-
Constructor Detail
-
TrackingIndexWriter
public TrackingIndexWriter(IndexWriter writer)
Create aTrackingIndexWriter
wrapping the providedIndexWriter
.
-
-
Method Detail
-
updateDocument
public long updateDocument(Term t, java.lang.Iterable<? extends IndexableField> d, Analyzer a) throws java.io.IOException
CallsIndexWriter.updateDocument(Term,Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
updateDocument
public long updateDocument(Term t, java.lang.Iterable<? extends IndexableField> d) throws java.io.IOException
CallsIndexWriter.updateDocument(Term,Iterable)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
updateDocuments
public long updateDocuments(Term t, java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer a) throws java.io.IOException
CallsIndexWriter.updateDocuments(Term,Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
updateDocuments
public long updateDocuments(Term t, java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs) throws java.io.IOException
CallsIndexWriter.updateDocuments(Term,Iterable)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
deleteDocuments
public long deleteDocuments(Term t) throws java.io.IOException
CallsIndexWriter.deleteDocuments(Term)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
deleteDocuments
public long deleteDocuments(Term... terms) throws java.io.IOException
CallsIndexWriter.deleteDocuments(Term...)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
deleteDocuments
public long deleteDocuments(Query q) throws java.io.IOException
CallsIndexWriter.deleteDocuments(Query)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
deleteDocuments
public long deleteDocuments(Query... queries) throws java.io.IOException
CallsIndexWriter.deleteDocuments(Query...)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
deleteAll
public long deleteAll() throws java.io.IOException
CallsIndexWriter.deleteAll()
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
addDocument
public long addDocument(java.lang.Iterable<? extends IndexableField> d, Analyzer a) throws java.io.IOException
CallsIndexWriter.addDocument(Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
addDocuments
public long addDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer a) throws java.io.IOException
CallsIndexWriter.addDocuments(Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
addDocument
public long addDocument(java.lang.Iterable<? extends IndexableField> d) throws java.io.IOException
CallsIndexWriter.addDocument(Iterable)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
addDocuments
public long addDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs) throws java.io.IOException
CallsIndexWriter.addDocuments(Iterable)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
addIndexes
public long addIndexes(Directory... dirs) throws java.io.IOException
CallsIndexWriter.addIndexes(Directory...)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
addIndexes
public long addIndexes(IndexReader... readers) throws java.io.IOException
CallsIndexWriter.addIndexes(IndexReader...)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
getGeneration
public long getGeneration()
Return the current generation being indexed.
-
getIndexWriter
public IndexWriter getIndexWriter()
Return the wrappedIndexWriter
.
-
getAndIncrementGeneration
public long getAndIncrementGeneration()
Return and increment current gen.
-
tryDeleteDocument
public long tryDeleteDocument(IndexReader reader, int docID) throws java.io.IOException
CalsIndexWriter.tryDeleteDocument(IndexReader,int)
and returns the generation that reflects this change.- Throws:
java.io.IOException
-
-