Hi!
Yonik Seeley wrote:
> On Jan 15, 2008 7:15 PM, Alexei Dets <[EMAIL PROTECTED]> wrote:
>> I'm curious, is there any particular reason why Lucene offers
>> IndexReader.deleteDocument(int docNum) but not
>> IndexWriter.deleteDocument(int docNum)?
> 
> Document ids are transient and can change.

I was under impression that document id can change _only_ after index merges
and optimizations, that id of the document definitely doesn't change if
index is not modified and doesn't change even after deletions or additions
of the new documents. Otherwise IndexReader.deleteDocument(int docNum) will
make no sense as well - all ids returned by the search will be invalidated
after first deleteDocument call?

> To figure out which ids you want to delete, you normally need to
> search (requiring a reader).

True. And to delete you normally need a writer because reader simply doesn't
have a write lock (and have no ability to obtain one if writer is always
opened) :-( Currently I'm using IndexWriter.deleteDocuments(Term term)
instead but it looks suboptimal as I already know the document id...

        Alexei



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

Reply via email to