Carlos Pita wrote:
Hi all,
Is there any guaranty that the maxDoc returned by a reader will be about
the
total number of indexed documents?
It struck me in this thread was that there may be a misunderstanding of the
relationship between numDocs/maxDoc and an IndexReader.
When an IndexReader is opened its maxDoc and numDocs will never change
regardless of the additions or deletions to the index. At least I've not been
able to make them change in my test cases.
So, when adding a new document after a reader has been opened, this new document
is not yet visible via the original reader, so if you are caching that array,
you would not update that array as it relates to the reader on the index at the
time the reader was opened.
When you open a new reader, the numDocs and maxDoc will reflect that addition.
Same applies to deletions. After opening the reader, you would need to
regenerate you array cache.
As Hoss has said, this is pretty much what FieldCache does and it holds the
caches keyed by the IndexReader.
Antony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]