lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Using TermDocs.seek vs. IndexReader.termDocs()
Date Sun, 17 Jan 2010 10:01:59 GMT
Hi

I remember a while ago a discussion around the efficiency of TermDocs.seek
and how it is inefficient and it's better to call IndexReader.termDocs
instead (actually someone was proposing to remove seek entirely from the
interface because of that). I've looked at FieldCacheImpl's
ByteCache.createValue and noticed it calls termDocs.seek.

So is it 'safe' to call seek again? Has the implementation improved? I
checked SegmentTermDocs change history but didn't see anything related, nor
in FieldCacheImpl. I'm iterating a TermEnum and need to get the documents
associated with each term. Basically, more or so what FieldCacheImpl does.
So I thought to use the same methodology (I used to call reader.termDocs on
every term before I saw FieldCacheImpl's implementation). Since TermEnum
moves forward, I hope that termDocs.seek will move forward as well, and I
only do it within the same field.

BTW, if there is a better way to do what I'm trying to (such as a better
API), I'd appreciate if you can give me a hint.

Thanks,
Shai

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message