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 Peter Pimley <pp...@semantico.com> on 2004/09/09 13:50:54 UTC

(n00b) Meaning of Hits.id (int)

Hello everyone.

I'm in the process of writing "my first lucene app", and I've got to the 
bit where I get my search results back (very exciting! ;).

My documents are not stored in their original form by lucene, but in a 
seperate database.  My lucene docs do however store the primary key, so 
that I can fetch the original version from the database to show the user 
(does that sound sane?)

I see that the 'Hits' class has an id (int) method, which sounds 
interesting.  The javadoc says "Returns the id for the nth document in 
this set.".  However, I can't find any mention anywhere else about 
Document ids.  Could anybody explain what this is?

Many Thanks in Advance,
Peter Pimley, Semantico


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


Re: (n00b) Meaning of Hits.id (int)

Posted by Peter Pimley <pp...@semantico.com>.
Oh, it's that simple. :)
Thanks for that!

Peter


Morus Walter wrote:

>It's lucenes internal id or document number which allows you to access
>the document and its stored fields.
>
>See 
>IndexSearcher.doc(int i)
>or
>IndexReader.document(int n)
>
>The docs just don't name the parameter 'id'.
>  
>


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


Re: (n00b) Meaning of Hits.id (int)

Posted by Morus Walter <mo...@tanto.de>.
Peter Pimley writes:
> 
> My documents are not stored in their original form by lucene, but in a 
> seperate database.  My lucene docs do however store the primary key, so 
> that I can fetch the original version from the database to show the user 
> (does that sound sane?)
> 
yes.

> I see that the 'Hits' class has an id (int) method, which sounds 
> interesting.  The javadoc says "Returns the id for the nth document in 
> this set.".  However, I can't find any mention anywhere else about 
> Document ids.  Could anybody explain what this is?
> 
It's lucenes internal id or document number which allows you to access
the document and its stored fields.

See 
IndexSearcher.doc(int i)
or
IndexReader.document(int n)

The docs just don't name the parameter 'id'.

Morus

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