lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Schneider <>
Subject Re: Is it possible to get only one Field from a Document?
Date Wed, 11 Jun 2008 13:07:32 GMT
Daan de Wit escreveu:
> But I doubt this will solve your memory issue because nonstored fields are not read when
retrieving the document.
Thanks for the fast reply Daan! Just for clearance, if I had all the 
code fields (filters) stored,  then it would make any difference?

> -----Original Message-----
> From: Daan de Wit [] 
> Sent: Wednesday, June 11, 2008 13:44
> To:
> Subject: RE: Is it possible to get only one Field from a Document?
> This is possible, you need to provider a FieldSelector to IndexReader#document(docId,
selector). This won't work with Hits though, because Hits does not expose the document number,
so you need to roll your own solution using TopDocs or HitCollector, for information see the
discussion in this issue:
> Kind regards,
> Daan de Wit
> -----Original Message-----
> From: Marcelo Schneider [] 
> Sent: Wednesday, June 11, 2008 13:29
> To:
> Subject: Is it possible to get only one Field from a Document?
> I have a environment where we have indexed a DB with about 6mil entries 
> with Lucene, and each row has 25 columns. 20 cols have integer codes 
> used as filters (indexed/unstored), and the other 5 have (very) large 
> texts (also indexed/unstored). Currently the search I'm doing is like this:
> Hits hits =;
> for (int i = 0; i < this.hits.length(); i++) {
>     Document doc = this.hits.doc(i);
>     String s = doc.get("fieldWanted");
>      // does everything with the result, etc
> }
> We are trying to reduce memory usage, however. Is it possible to return 
> a Document object with just the Fields I really need? In the example, 
> each Document have 25 fields, and I just need one... would this 
> theoretically make any difference?

Esta mensagem foi verificada pelo sistema de antivírus da Dígitro e
acredita-se estar livre de perigo.

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

View raw message