lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <>
Subject Re: Document loading
Date Tue, 06 Oct 2009 22:05:43 GMT
a call to IndexSearcher.doc(docId) will load the document. Internally
this call forwards to IndexReader.document(docId) which could be very
expensive because this method will load all stored document fields.

I would recommend to have a look at IndexSearcher.doc(docId,
FieldSelector). This method offers you way more control over field
loading costs. With the FieldSelector you can directly load fields, do
lazy loading or stop the loading process once a certain field was
If you do not load a field due to the fieldSelector a call to
Document.get("fieldname") will return null.


On Tue, Oct 6, 2009 at 2:38 PM, Dragon Fly <> wrote:
> Hi,
> Which of the following method actually loads the document from disk?
> (1) Document document = searcher.doc (docId);
> OR
> (2) string value = document.get ("FirstNameField");
> It's probably searcher.doc but I just want to be sure.  Thank you.
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection.

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

View raw message