lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <simon.willna...@googlemail.com>
Subject Re: Document loading
Date Tue, 06 Oct 2009 22:05:43 GMT
Hi,
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
loaded.
If you do not load a field due to the fieldSelector a call to
Document.get("fieldname") will return null.

Simon

On Tue, Oct 6, 2009 at 2:38 PM, Dragon Fly <dragon-fly999@hotmail.com> 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.
> http://clk.atdmt.com/GBL/go/177141664/direct/01/

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message