Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Document loading

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


dragon-fly999 at hotmail

Oct 6, 2009, 5:38 AM

Post #1 of 3 (425 views)
Permalink
Document loading

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/


simon.willnauer at googlemail

Oct 6, 2009, 3:05 PM

Post #2 of 3 (393 views)
Permalink
Re: Document loading [In reply to]

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 [at] hotmail> 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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


dragon-fly999 at hotmail

Oct 7, 2009, 4:49 AM

Post #3 of 3 (387 views)
Permalink
RE: Document loading [In reply to]

Thanks.

> Date: Wed, 7 Oct 2009 00:05:43 +0200
> Subject: Re: Document loading
> From: simon.willnauer [at] googlemail
> To: java-user [at] lucene
>
> 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 [at] hotmail> 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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>

_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.