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".
Inheritance
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
| Improve this Doc View SourceLiveFieldValues(ReferenceManager<S>, T)
Declaration
protected LiveFieldValues(ReferenceManager<S> mgr, T missingValue)
Parameters
Type | Name | Description |
---|---|---|
ReferenceManager<S> | mgr | |
T | missingValue |
Properties
| Improve this Doc View SourceCount
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 |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceAdd(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 |
---|---|---|
System.String | id | |
T | value |
AfterRefresh(Boolean)
Declaration
public virtual void AfterRefresh(bool didRefresh)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | didRefresh |
BeforeRefresh()
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 |
---|---|---|
System.String | id |
Dispose()
Releases all resources used by the LiveFieldValues<S, T>.
Declaration
public void Dispose()
Dispose(Boolean)
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 |
---|---|---|
System.Boolean | 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 |
---|---|---|
System.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 | |
System.String | id |
Returns
Type | Description |
---|---|
T |