[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: Why there is no IndexWriter.deleteDocument(int docNum) method?
From:       Alexei Dets <adets () idsk ! com>
Date:       2008-01-16 19:13:41
Message-ID: fmll16$6h5$1 () ger ! gmane ! org
[Download RAW message or body]

Hi!
Yonik Seeley wrote:
> On Jan 15, 2008 7:15 PM, Alexei Dets <adets@idsk.com> 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic