Jason Rutherglen <[EMAIL PROTECTED]> wrote:

> One of the things I do not understand about IndexWriter deletes is
> it does not reuse an already open TermInfosReader with the tii
> loaded.  Isn't this slower than deleting using an already open
> IndexReader?

That's right: every time IW decides to flush deletes (which is
currently before a merge starts, when autoCommit=false), it visits
each segment and 1) opens a SegmentReader, 2) translates all buffered
deletes (by term, by query) into docIDs stored into the deletedDocs of
that SegmentReader, writes new _X_N.del files to record the deletes
for the segment and then closes the SegmentReader.

We could instead keep these SegmentReaders open and reuse them for
applying deletes.  Then the IndexWriter could present an IndexReader
(MultiReader) that reads these segments, plus the IndexReader reading
buffered docs in RAM.  This would basically be a "combined
IndexWriter / IndexReader".

I think the IndexReader that reads DocumentWriter's RAM buffer would
still search a point-in-time snapshot of the index, unlike
InstantiatedIndexReader, and require an explicit reopen() to refresh.
This is because some non-trivial computation is still required when
there are changes.  EG if a delete-by-query has happened, reopen()
must resolve that query into docIDs.

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to