Package org.apache.lucene.search
Class LiveFieldValues<S,T> 
java.lang.Object
org.apache.lucene.search.LiveFieldValues<S,T> 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- ReferenceManager.RefreshListener
public abstract class LiveFieldValues<S,T> 
extends Object
implements ReferenceManager.RefreshListener, Closeable
Tracks live field values across NRT reader reopens.
  This holds a map for all updated ids since
  the last reader reopen.  Once the NRT reader is reopened,
  it prunes the map.  This means you must reopen your NRT
  reader periodically otherwise the RAM consumption of
  this class will grow unbounded!
  
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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidCall this after you've successfully added a document to the index, to record what value you just set the field to.voidafterRefresh(boolean didRefresh) Called after the attempted refresh; if the refresh did open a new reference then didRefresh will be true andReferenceManager.acquire()is guaranteed to return the new reference.voidCalled right before a refresh attempt starts.voidclose()voidCall this after you've successfully deleted a document from the index.Returns the current value for this id, or null if the id isn't in the index or was deleted.protected abstract TlookupFromSearcher(S s, String id) This is called when the id/value was already flushed & opened in an NRT IndexSearcher.intsize()Returns the [approximate] number of id/value pairs buffered in RAM.
- 
Constructor Details- 
LiveFieldValues
 
- 
- 
Method Details- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
beforeRefreshDescription copied from interface:ReferenceManager.RefreshListenerCalled right before a refresh attempt starts.- Specified by:
- beforeRefreshin interface- ReferenceManager.RefreshListener
- Throws:
- IOException
 
- 
afterRefreshDescription copied from interface:ReferenceManager.RefreshListenerCalled after the attempted refresh; if the refresh did open a new reference then didRefresh will be true andReferenceManager.acquire()is guaranteed to return the new reference.- Specified by:
- afterRefreshin interface- ReferenceManager.RefreshListener
- Throws:
- IOException
 
- 
addCall this after you've successfully added a document to the index, to record what value you just set the field to.
- 
deleteCall this after you've successfully deleted a document from the index.
- 
sizepublic int size()Returns the [approximate] number of id/value pairs buffered in RAM.
- 
getReturns the current value for this id, or null if the id isn't in the index or was deleted.- Throws:
- IOException
 
- 
lookupFromSearcherThis is called when the id/value was already flushed & opened in an NRT IndexSearcher. You must implement this to go look up the value (eg, via doc values, field cache, stored fields, etc.).- Throws:
- IOException
 
 
-