lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shekhar Iyer <>
Subject FieldCache refresh during IndexReader.reopen()
Date Mon, 14 Sep 2009 05:26:53 GMT

I am using the lucene FieldCache mechanism to cache one field in my search
application (for rapid search response). Before I proceed with this change I
wanted to understand the implications of a FieldCache refresh against a
commit and an optimize.

The way I am using the FieldCache is 

String[] values = FieldCache.DEFAULT.getStrings(indexReader, fieldName);

Note,  I am at lucene version 2.3.3 
As I understand it the field cache is only loaded the first time it is
accessed (for a given IndexReader).

With this in mind I have the following questions.

1. I use the IndexReader.reopen() to get incremental commit changes. This
means I will get a new version of the field cache if I call the above code
statement after a successful reopen (in case the reopen returns me a new
IndexReader instance), is my understanding correct ?

2. So long as I index in the field cache for only doc ids returned by a
search, I don't need to worry about deleted docs right ?

3. I am more interested in how the reopen() behaves in case of an optimize.
Does it return a new IndexReader and will I be guaranteed a new instance of
the field cache upon subsequent access to

FieldCache.DEFAULT.getStrings(indexReader, fieldName);

Thanks for your help
View this message in context:
Sent from the Lucene - General mailing list archive at

View raw message