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 byControlledRealTimeReopenThreadto 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, otherwiseControlledRealTimeReopenThreadwon't know about the changes.
-
-
Constructor Summary
Constructors Constructor Description TrackingIndexWriter(IndexWriter writer)Create aTrackingIndexWriterwrapping the providedIndexWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaddDocument(Iterable<? extends IndexableField> d)CallsIndexWriter.addDocument(Iterable)and returns the generation that reflects this change.longaddDocument(Iterable<? extends IndexableField> d, Analyzer a)CallsIndexWriter.addDocument(Iterable,Analyzer)and returns the generation that reflects this change.longaddDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs)CallsIndexWriter.addDocuments(Iterable)and returns the generation that reflects this change.longaddDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs, Analyzer a)CallsIndexWriter.addDocuments(Iterable,Analyzer)and returns the generation that reflects this change.longaddIndexes(IndexReader... readers)CallsIndexWriter.addIndexes(IndexReader...)and returns the generation that reflects this change.longaddIndexes(Directory... dirs)CallsIndexWriter.addIndexes(Directory...)and returns the generation that reflects this change.longdeleteAll()CallsIndexWriter.deleteAll()and returns the generation that reflects this change.longdeleteDocuments(Term t)CallsIndexWriter.deleteDocuments(Term)and returns the generation that reflects this change.longdeleteDocuments(Term... terms)CallsIndexWriter.deleteDocuments(Term...)and returns the generation that reflects this change.longdeleteDocuments(Query q)CallsIndexWriter.deleteDocuments(Query)and returns the generation that reflects this change.longdeleteDocuments(Query... queries)CallsIndexWriter.deleteDocuments(Query...)and returns the generation that reflects this change.longgetAndIncrementGeneration()Return and increment current gen.longgetGeneration()Return the current generation being indexed.IndexWritergetIndexWriter()Return the wrappedIndexWriter.longtryDeleteDocument(IndexReader reader, int docID)CalsIndexWriter.tryDeleteDocument(IndexReader,int)and returns the generation that reflects this change.longupdateDocument(Term t, Iterable<? extends IndexableField> d)CallsIndexWriter.updateDocument(Term,Iterable)and returns the generation that reflects this change.longupdateDocument(Term t, Iterable<? extends IndexableField> d, Analyzer a)CallsIndexWriter.updateDocument(Term,Iterable,Analyzer)and returns the generation that reflects this change.longupdateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs)CallsIndexWriter.updateDocuments(Term,Iterable)and returns the generation that reflects this change.longupdateDocuments(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 aTrackingIndexWriterwrapping 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 IOExceptionCallsIndexWriter.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
-
-