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 Bertrand VENZAL <be...@cirso.fr> on 2005/01/13 17:01:40 UTC

Réf. : Re: Réf. : Re: IndexSearcher andnumber of occurence



Great, thanks for your help, I understand things quickly but I need lots of
explanation .. ;-)

For who is interested .. I was using :

int id = hits.doc(i);
instead of :
int id = hits.id(i);

Tchõ
Bertrand





On Jan 13, 2005, at 10:17 AM, Bertrand VENZAL wrote:

>
>
>
> Hi,
>
> Thanks for your quick answer, I understood wot u meant by using the
> indexSearcher to get the termFreqVector. But, you use an int as an id
> to
> find the termFrequency so I suppose that it is the position number in
> the
> IndexReader vector.
> My problem is : during the indexing phase, I can store the id, but if a
> document is deleted and recreated later on (like in an update), this
> will
> change my vector and all the id's previously set will be no more
> correct.
> Am i right on this point ? or am i missing something ...

Yes, the Document id (the one Lucene uses) is not to be relied on
long-term.  But, in the example you'd get it from Hits immediately
after a search, and thus it would be accurate and usable.  You do not
need to store any the id during indexing - Lucene maintains it and
gives it to you from Hits.

                Erik


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







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