lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand VENZAL" <>
Subject Réf. : Re: Réf. : Re: IndexSearcher and number of occurence
Date Thu, 13 Jan 2005 16:01:40 GMT

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 =;


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.


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

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

View raw message