Hi,
They get evicted when the segment of that index is closed. After that
theres no reference to them anymore through a
WeakHashMap<LeaveReader,Cache> and thecache object gets freed by GC.
This happens on refresh of searcher where unused segments are closed and
new ones are openend. There is no way to get rid of entries on a live
searcher.
FieldCache is no longer available since Lucene 6, so which version are
you using? Since Lucene 4 it is better to use DocValues fields for
sorting or facetting/aggregations.
If you are using Solr, theres still a clone of FieldCache as part of
Solr's codebase (and is not supported by Lucene anymore), but thats only
for legacy indexes where the schema was not updated to use DocValues. In
an "ideally configured Solr server", the Admin UI shows no entries below
Core's FieldCache stats. If you see entries there go and replace those
field's config by adding docvalues=true.
Uwe
Am 08.06.2022 um 15:26 schrieb Poorna Murali:
> Hi,
>
> I would like to know if there is any automatic eviction policy for the
> field cache entries. I understand that it gets invalidated when a new
> searcher opens. But, my question is in case if gc runs or if there is any
> other scenario which could evict the unused entries from fieldcache.
>
> Please help to clarify the same.
>
> Thanks
> Poorna
>
--
Uwe Schindler
Achterdiek 19, D-28357 Bremen
https://www.thetaphi.de eMail: uwe@thetaphi.de
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org