lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn van Groningen (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3360) Move FieldCache to IndexReader
Date Wed, 17 Aug 2011 12:51:27 GMT


Martijn van Groningen commented on LUCENE-3360:

I actually prefer the name AtomicFieldCache, since this matches other
places (eg. AtomicReaderContext), and because it's not necessarily a
segment (SlowMultiReaderWrapper returns an instance).
For naming consistency I agree with you there. I will make the SegmentFieldCacheImpl package
private. I kept it in the patch it public, b/c FieldCacheImpl was public too.

I'm nervous about how the [deprecated] FC makes a new SlowMRWrapper()
for each getXXX call – I think this class uses "this" as the
getFieldCacheKey? Won't this mean each lookup will build a new cache
entry? (Hmm... but then why don't tests fail... I think we have at
least one test verifying same instance is returned for 2 calls in a
The current FielCache api requires a reader to be specified. That specified reader is used
as key.

bq. I love the name InsaneFieldCache!
I love the name too :)

bq. In 4.0 we just change the API and make you create it yourself.
So remove [deprecated] FieldCache completely? When back porting to 3x we obviously need to
keep FieldCache classes...

> Move FieldCache to IndexReader
> ------------------------------
>                 Key: LUCENE-3360
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Martijn van Groningen
>             Fix For: 3.4, 4.0
>         Attachments: LUCENE-3360.patch, LUCENE-3360.patch, LUCENE-3360.patch
> Move the static FieldCache.DEFAULT field instance to atomic IndexReaders, so that FieldCache
insanity caused by the WeakHashMap no longer occurs.
> * Add a new method to IndexReader that by default throws an UOE:
> {code}public FieldCache getFieldCache(){code}
> * The SegmentReader implements this method and returns its own internal FieldCache implementation.
This implementation just uses a HashMap<Entry<T>,Object>> to store entries.
> * The SlowMultiReaderWrapper implements this method as well and basically behaves the
same as the current FieldCacheImpl.
> This issue won't solve the insanity that comes from inconsistent usage of a single field
(for example retrieve both int[] and DocTermIndex for the same field). 

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message