public abstract class LiveFieldValues<S,T> extends java.lang.Object implements ReferenceManager.RefreshListener, java.io.Closeable
NOTE: you must ensure the same id is never updated at the same time by two threads, because in this case you cannot in general know which thread "won".
| Constructor and Description |
|---|
LiveFieldValues(ReferenceManager<S> mgr,
T missingValue)
The missingValue must be non-null.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.String id,
T value)
Call this after you've successfully added a document
to the index, to record what value you just set the
field to.
|
void |
afterRefresh(boolean didRefresh)
Called after the attempted refresh; if the refresh
did open a new reference then didRefresh will be true
and
ReferenceManager.acquire() is guaranteed to return the new
reference. |
void |
beforeRefresh()
Called right before a refresh attempt starts.
|
void |
close() |
void |
delete(java.lang.String id)
Call this after you've successfully deleted a document
from the index.
|
T |
get(java.lang.String id)
Returns the current value for this id, or null if the
id isn't in the index or was deleted.
|
protected abstract T |
lookupFromSearcher(S s,
java.lang.String id)
This is called when the id/value was already flushed and opened
in an NRT IndexSearcher.
|
int |
size()
Returns the [approximate] number of id/value pairs
buffered in RAM.
|
public LiveFieldValues(ReferenceManager<S> mgr, T missingValue)
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void beforeRefresh()
throws java.io.IOException
ReferenceManager.RefreshListenerbeforeRefresh in interface ReferenceManager.RefreshListenerjava.io.IOExceptionpublic void afterRefresh(boolean didRefresh)
throws java.io.IOException
ReferenceManager.RefreshListenerReferenceManager.acquire() is guaranteed to return the new
reference.afterRefresh in interface ReferenceManager.RefreshListenerjava.io.IOExceptionpublic void add(java.lang.String id,
T value)
public void delete(java.lang.String id)
public int size()
public T get(java.lang.String id) throws java.io.IOException
java.io.IOExceptionprotected abstract T lookupFromSearcher(S s, java.lang.String id) throws java.io.IOException
java.io.IOExceptionCopyright © 2000–2025 The Apache Software Foundation. All rights reserved.