LiveFieldValues

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".

Constructors

Link copied to clipboard
constructor(mgr: ReferenceManager<S>, missingValue: T)

Functions

Link copied to clipboard
fun add(id: String, value: T)

Call this after you've successfully added a document to the index, to record what value you just set the field to.

Link copied to clipboard
open override fun afterRefresh(didRefresh: Boolean)
Link copied to clipboard
open override fun beforeRefresh()
Link copied to clipboard
open override fun close()
Link copied to clipboard
fun delete(id: String)

Call this after you've successfully deleted a document from the index.

Link copied to clipboard
operator fun get(id: String): T?

Returns the current value for this id, or null if the id isn't in the index or was deleted.

Link copied to clipboard
fun size(): Int

Returns the approximate number of id/value pairs buffered in RAM.