|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.index.NRTManager
public class NRTManager
Utility class to manage sharing near-real-time searchers across multiple searching threads.
NOTE: to use this class, you must call reopen
periodically. The NRTManagerReopenThread
is a
simple class to do this on a periodic basis. If you
implement your own reopener, be sure to call addWaitingListener(org.apache.lucene.index.NRTManager.WaitingListener)
so your reopener is notified when a
caller is waiting for a specific generation searcher.
Nested Class Summary | |
---|---|
static interface |
NRTManager.WaitingListener
NRTManager invokes this interface to notify it when a caller is waiting for a specific generation searcher to be visible. |
Constructor Summary | |
---|---|
NRTManager(IndexWriter writer)
Create new NRTManager. |
|
NRTManager(IndexWriter writer,
ExecutorService es)
Create new NRTManager. |
Method Summary | |
---|---|
long |
addDocument(Document d)
|
long |
addDocument(Document d,
Analyzer a)
|
long |
addDocuments(Collection<Document> docs)
|
long |
addDocuments(Collection<Document> docs,
Analyzer a)
|
void |
addWaitingListener(NRTManager.WaitingListener l)
Adds a listener, to be notified when a caller is waiting for a specific generation searcher to be visible. |
void |
close()
NOTE: caller must separately close the writer. |
long |
deleteDocuments(Query q)
|
long |
deleteDocuments(Term t)
|
IndexSearcher |
get()
Returns the most current searcher. |
IndexSearcher |
get(boolean requireDeletes)
Just like get() , but by passing false for
requireDeletes, you can get faster reopen time, but
the returned reader is allowed to not reflect all
deletions. |
IndexSearcher |
get(long targetGen)
Call this if you require a searcher reflecting all changes as of the target generation. |
IndexSearcher |
get(long targetGen,
boolean requireDeletes)
Call this if you require a searcher reflecting all changes as of the target generation, and you don't require deletions to be reflected. |
long |
getCurrentSearchingGen(boolean requiresDeletes)
Returns generation of current searcher. |
void |
release(IndexSearcher s)
Release the searcher obtained from get() or get(long) . |
void |
removeWaitingListener(NRTManager.WaitingListener l)
Remove a listener added with addWaitingListener(org.apache.lucene.index.NRTManager.WaitingListener) . |
boolean |
reopen(boolean applyDeletes)
Call this when you need the NRT reader to reopen. |
long |
updateDocument(Term t,
Document d)
|
long |
updateDocument(Term t,
Document d,
Analyzer a)
|
long |
updateDocuments(Term t,
Collection<Document> docs)
|
long |
updateDocuments(Term t,
Collection<Document> docs,
Analyzer a)
|
protected void |
warm(IndexReader reader)
Override this to warm the newly opened reader before it's swapped in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NRTManager(IndexWriter writer) throws IOException
writer
- IndexWriter to open near-real-time
readers
IOException
public NRTManager(IndexWriter writer, ExecutorService es) throws IOException
writer
- IndexWriter to open near-real-time
readerses
- ExecutorService to pass to the IndexSearcher
IOException
Method Detail |
---|
public void addWaitingListener(NRTManager.WaitingListener l)
public void removeWaitingListener(NRTManager.WaitingListener l)
addWaitingListener(org.apache.lucene.index.NRTManager.WaitingListener)
.
public long updateDocument(Term t, Document d, Analyzer a) throws IOException
IOException
public long updateDocument(Term t, Document d) throws IOException
IOException
public long updateDocuments(Term t, Collection<Document> docs, Analyzer a) throws IOException
IOException
public long updateDocuments(Term t, Collection<Document> docs) throws IOException
IOException
public long deleteDocuments(Term t) throws IOException
IOException
public long deleteDocuments(Query q) throws IOException
IOException
public long addDocument(Document d, Analyzer a) throws IOException
IOException
public long addDocuments(Collection<Document> docs, Analyzer a) throws IOException
IOException
public long addDocument(Document d) throws IOException
IOException
public long addDocuments(Collection<Document> docs) throws IOException
IOException
public IndexSearcher get()
get(long)
instead.
public IndexSearcher get(boolean requireDeletes)
get()
, but by passing false
for
requireDeletes, you can get faster reopen time, but
the returned reader is allowed to not reflect all
deletions. See IndexReader.open(IndexWriter,boolean)
public IndexSearcher get(long targetGen)
targetGen
- Returned searcher must reflect changes
as of this generationpublic IndexSearcher get(long targetGen, boolean requireDeletes)
targetGen
- Returned searcher must reflect changes
as of this generationrequireDeletes
- If true, the returned searcher must
reflect all deletions. This can be substantially more
costly than not applying deletes. Note that if you
pass false, it's still possible that some or all
deletes may have been applied.public long getCurrentSearchingGen(boolean requiresDeletes)
public void release(IndexSearcher s) throws IOException
get()
or get(long)
.
IOException
public boolean reopen(boolean applyDeletes) throws IOException
applyDeletes
- If true, the newly opened reader
will reflect all deletes
IOException
protected void warm(IndexReader reader) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |