You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Askar Zaidi <as...@gmail.com> on 2007/07/24 21:59:50 UTC

FieldCache for Search

Hey Guys,

>From what I understand, FieldCache is used to store only the field required
for search. I am using a Document object and then using doc.get("item"). One
of my fields is HUGE, so using Document will slow things down.

How can I use FieldCache ? an example ?

thanks,
AZ

Re: FieldCache for Search

Posted by Erick Erickson <er...@gmail.com>.
You might try lazy loading. See
IndexReader.*document<file:///C:/lucene-2.1.0/docs/api/org/apache/lucene/index/IndexReader.html#document%28int,%20org.apache.lucene.document.FieldSelector%29>
*(int n, FieldSelector<file:///C:/lucene-2.1.0/docs/api/org/apache/lucene/document/FieldSelector.html>
 fieldSelector),
particularly the FieldSelector. It allows you to selectively load only the
fields you want.

Otherwise, I'm sure if you looked in the unit tests you'd find examples
of how to use FieldCache. If your fields are really that huge, I'm not
sure how FieldCache would help you all that much before you'd run out
of memory. Perhaps you could outline your problem in more detail
and get some better answers.....

Best
Erick

On 7/24/07, Askar Zaidi <as...@gmail.com> wrote:
>
> Hey Guys,
>
> From what I understand, FieldCache is used to store only the field
> required
> for search. I am using a Document object and then using doc.get("item").
> One
> of my fields is HUGE, so using Document will slow things down.
>
> How can I use FieldCache ? an example ?
>
> thanks,
> AZ
>