public class TrackingIndexWriter extends Object
ControlledRealTimeReopenThread
to ensure specific
changes are visible. Create this class (passing your
IndexWriter), and then pass this class to ControlledRealTimeReopenThread
.
Be sure to make all changes via the
TrackingIndexWriter, otherwise ControlledRealTimeReopenThread
won't know about the changes.Constructor and Description |
---|
TrackingIndexWriter(IndexWriter writer)
Create a
TrackingIndexWriter wrapping the
provided IndexWriter . |
Modifier and Type | Method and Description |
---|---|
long |
addDocument(Iterable<? extends IndexableField> d)
Calls
IndexWriter.addDocument(Iterable)
and returns the generation that reflects this change. |
long |
addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs)
Calls
IndexWriter.addDocuments(Iterable) and
returns the generation that reflects this change. |
long |
addIndexes(CodecReader... readers)
Calls
IndexWriter.addIndexes(CodecReader...)
and returns the generation that reflects this change. |
long |
addIndexes(Directory... dirs)
Calls
IndexWriter.addIndexes(Directory...) and
returns the generation that reflects this change. |
long |
deleteAll()
Calls
IndexWriter.deleteAll() and returns the
generation that reflects this change. |
long |
deleteDocuments(Query... queries)
Calls
IndexWriter.deleteDocuments(Query...)
and returns the generation that reflects this change. |
long |
deleteDocuments(Query q)
Calls
IndexWriter.deleteDocuments(Query...) and
returns the generation that reflects this change. |
long |
deleteDocuments(Term... terms)
Calls
IndexWriter.deleteDocuments(Term...) and
returns the generation that reflects this change. |
long |
deleteDocuments(Term t)
Calls
IndexWriter.deleteDocuments(Term...) 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 wrapped
IndexWriter . |
long |
tryDeleteDocument(IndexReader reader,
int docID)
Cals
IndexWriter.tryDeleteDocument(IndexReader,int) and
returns the generation that reflects this change. |
long |
updateDocument(Term t,
Iterable<? extends IndexableField> d)
Calls
IndexWriter.updateDocument(Term,Iterable) and
returns the generation that reflects this change. |
long |
updateDocuments(Term t,
Iterable<? extends Iterable<? extends IndexableField>> docs)
Calls
IndexWriter.updateDocuments(Term,Iterable) and returns
the generation that reflects this change. |
public TrackingIndexWriter(IndexWriter writer)
TrackingIndexWriter
wrapping the
provided IndexWriter
.public long updateDocument(Term t, Iterable<? extends IndexableField> d) throws IOException
IndexWriter.updateDocument(Term,Iterable)
and
returns the generation that reflects this change.IOException
public long updateDocuments(Term t, Iterable<? extends Iterable<? extends IndexableField>> docs) throws IOException
IndexWriter.updateDocuments(Term,Iterable)
and returns
the generation that reflects this change.IOException
public long deleteDocuments(Term t) throws IOException
IndexWriter.deleteDocuments(Term...)
and
returns the generation that reflects this change.IOException
public long deleteDocuments(Term... terms) throws IOException
IndexWriter.deleteDocuments(Term...)
and
returns the generation that reflects this change.IOException
public long deleteDocuments(Query q) throws IOException
IndexWriter.deleteDocuments(Query...)
and
returns the generation that reflects this change.IOException
public long deleteDocuments(Query... queries) throws IOException
IndexWriter.deleteDocuments(Query...)
and returns the generation that reflects this change.IOException
public long deleteAll() throws IOException
IndexWriter.deleteAll()
and returns the
generation that reflects this change.IOException
public long addDocument(Iterable<? extends IndexableField> d) throws IOException
IndexWriter.addDocument(Iterable)
and returns the generation that reflects this change.IOException
public long addDocuments(Iterable<? extends Iterable<? extends IndexableField>> docs) throws IOException
IndexWriter.addDocuments(Iterable)
and
returns the generation that reflects this change.IOException
public long addIndexes(Directory... dirs) throws IOException
IndexWriter.addIndexes(Directory...)
and
returns the generation that reflects this change.IOException
public long addIndexes(CodecReader... readers) throws IOException
IndexWriter.addIndexes(CodecReader...)
and returns the generation that reflects this change.IOException
public long getGeneration()
public IndexWriter getIndexWriter()
IndexWriter
.public long getAndIncrementGeneration()
public long tryDeleteDocument(IndexReader reader, int docID) throws IOException
IndexWriter.tryDeleteDocument(IndexReader,int)
and
returns the generation that reflects this change.IOException
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.