Package org.apache.lucene.index
Class TrackingIndexWriter
- java.lang.Object
-
- org.apache.lucene.index.TrackingIndexWriter
-
public class TrackingIndexWriter extends 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(Iterable<? extends IndexableField> d)
CallsIndexWriter.addDocument(Iterable)
and returns the generation that reflects this change.long
addDocument(Iterable<? extends IndexableField> d, Analyzer a)
CallsIndexWriter.addDocument(Iterable,Analyzer)
and returns the generation that reflects this change.long
addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs)
CallsIndexWriter.addDocuments(Iterable)
and returns the generation that reflects this change.long
addDocuments(Iterable<? extends 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, Iterable<? extends IndexableField> d)
CallsIndexWriter.updateDocument(Term,Iterable)
and returns the generation that reflects this change.long
updateDocument(Term t, Iterable<? extends IndexableField> d, Analyzer a)
CallsIndexWriter.updateDocument(Term,Iterable,Analyzer)
and returns the generation that reflects this change.long
updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs)
CallsIndexWriter.updateDocuments(Term,Iterable)
and returns the generation that reflects this change.long
updateDocuments(Term t, Iterable<? extends 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, Iterable<? extends IndexableField> d, Analyzer a) throws IOException
CallsIndexWriter.updateDocument(Term,Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
IOException
-
updateDocument
public long updateDocument(Term t, Iterable<? extends IndexableField> d) throws IOException
CallsIndexWriter.updateDocument(Term,Iterable)
and returns the generation that reflects this change.- Throws:
IOException
-
updateDocuments
public long updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs, Analyzer a) throws IOException
CallsIndexWriter.updateDocuments(Term,Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
IOException
-
updateDocuments
public long updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs) throws IOException
CallsIndexWriter.updateDocuments(Term,Iterable)
and returns the generation that reflects this change.- Throws:
IOException
-
deleteDocuments
public long deleteDocuments(Term t) throws IOException
CallsIndexWriter.deleteDocuments(Term)
and returns the generation that reflects this change.- Throws:
IOException
-
deleteDocuments
public long deleteDocuments(Term... terms) throws IOException
CallsIndexWriter.deleteDocuments(Term...)
and returns the generation that reflects this change.- Throws:
IOException
-
deleteDocuments
public long deleteDocuments(Query q) throws IOException
CallsIndexWriter.deleteDocuments(Query)
and returns the generation that reflects this change.- Throws:
IOException
-
deleteDocuments
public long deleteDocuments(Query... queries) throws IOException
CallsIndexWriter.deleteDocuments(Query...)
and returns the generation that reflects this change.- Throws:
IOException
-
deleteAll
public long deleteAll() throws IOException
CallsIndexWriter.deleteAll()
and returns the generation that reflects this change.- Throws:
IOException
-
addDocument
public long addDocument(Iterable<? extends IndexableField> d, Analyzer a) throws IOException
CallsIndexWriter.addDocument(Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
IOException
-
addDocuments
public long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs, Analyzer a) throws IOException
CallsIndexWriter.addDocuments(Iterable,Analyzer)
and returns the generation that reflects this change.- Throws:
IOException
-
addDocument
public long addDocument(Iterable<? extends IndexableField> d) throws IOException
CallsIndexWriter.addDocument(Iterable)
and returns the generation that reflects this change.- Throws:
IOException
-
addDocuments
public long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs) throws IOException
CallsIndexWriter.addDocuments(Iterable)
and returns the generation that reflects this change.- Throws:
IOException
-
addIndexes
public long addIndexes(Directory... dirs) throws IOException
CallsIndexWriter.addIndexes(Directory...)
and returns the generation that reflects this change.- Throws:
IOException
-
addIndexes
public long addIndexes(IndexReader... readers) throws IOException
CallsIndexWriter.addIndexes(IndexReader...)
and returns the generation that reflects this change.- Throws:
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 IOException
CalsIndexWriter.tryDeleteDocument(IndexReader,int)
and returns the generation that reflects this change.- Throws:
IOException
-
-