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 jian chen <ch...@gmail.com> on 2005/06/25 06:48:36 UTC

document ids in "cached" in Hits and index merge

Hi,

I have a stupid question regarding the transient nature of the document ids. 

As I understand, documents will obtain new doc ids during the index
merge. Suppose if you do a search and got the Hits object. When you
iterate through the documents by id, the index merge happens. How the
merge and new ids created do not mess up the retrieval of Hits
documents?

Could anyone please enlighten me on this synchronization issue?

Thanks a lot,

Jian

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


Re: document ids in "cached" in Hits and index merge

Posted by Robert Newson <rn...@connected.com>.
As long as you use the same Searcher object, you shouldn't see document 
ids changing.

When you open a searcher you get a consistent view of the segments that 
existed at the time. Merging creates new segments which you won't see 
until you create a new searcher.

In short, retrieving hits while indexing and merging works correctly, no 
surprises.

B.

jian chen wrote:
> Hi,
> 
> I have a stupid question regarding the transient nature of the document ids. 
> 
> As I understand, documents will obtain new doc ids during the index
> merge. Suppose if you do a search and got the Hits object. When you
> iterate through the documents by id, the index merge happens. How the
> merge and new ids created do not mess up the retrieval of Hits
> documents?
> 
> Could anyone please enlighten me on this synchronization issue?
> 
> Thanks a lot,
> 
> Jian


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