Class LiveFieldValues<S, T>
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".Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public abstract class LiveFieldValues<S, T> : ReferenceManager.IRefreshListener, IDisposable where S : class
Type Parameters
Name | Description |
---|---|
S | |
T |
Constructors
LiveFieldValues(ReferenceManager<S>, T)
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".Declaration
protected LiveFieldValues(ReferenceManager<S> mgr, T missingValue)
Parameters
Type | Name | Description |
---|---|---|
ReferenceManager<S> | mgr | |
T | missingValue |
Properties
Count
Returns the [approximate] number of id/value pairs buffered in RAM.
NOTE: This was size() in Lucene.Declaration
public virtual int Count { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Add(string, T)
Call this after you've successfully added a document to the index, to record what value you just set the field to.
Declaration
public virtual void Add(string id, T value)
Parameters
Type | Name | Description |
---|---|---|
string | id | |
T | value |
AfterRefresh(bool)
Called after the attempted refresh; if the refresh
did open a new reference then didRefresh will be true
and Acquire() is guaranteed to return the new
reference.
Declaration
public virtual void AfterRefresh(bool didRefresh)
Parameters
Type | Name | Description |
---|---|---|
bool | didRefresh |
BeforeRefresh()
Called right before a refresh attempt starts.
Declaration
public virtual void BeforeRefresh()
Delete(string)
Call this after you've successfully deleted a document from the index.
Declaration
public virtual void Delete(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
Dispose()
Releases all resources used by the LiveFieldValues<S, T>.
Declaration
public void Dispose()
Dispose(bool)
Releases resources used by the LiveFieldValues<S, T> and if overridden in a derived class, optionally releases unmanaged resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
|
Get(string)
Returns the current value for this id, or null
if the
id isn't in the index or was deleted.
Declaration
public virtual T Get(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
Returns
Type | Description |
---|---|
T |
LookupFromSearcher(S, string)
This 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.).
Declaration
protected abstract T LookupFromSearcher(S s, string id)
Parameters
Type | Name | Description |
---|---|---|
S | s | |
string | id |
Returns
Type | Description |
---|---|
T |