lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reg <register9...@gmail.com>
Subject Re: TrackingIndexWriter.tryDeleteDocument(IndexReader, int) vs deleteDocuments(Query)
Date Tue, 07 May 2013 17:58:29 GMT
TrackingIndexWriter.tryDeleteDocument(IndexReader, int) returns an
AtomicInteger indexingGen.  And in my case it returns 1 which means the
underlying IndexWriter.tryDeleteDocument(IndexReader, int) returns true.

TrackingIndexWriter is not IndexWriter and we can't pass it to
DirectoryReader.open(..)


On Tue, May 7, 2013 at 4:06 AM, Ian Lea <ian.lea@gmail.com> wrote:

> Does the tryDeleteDocument() call return true or false?  The 4.2.1
> javadocs for IndexWriter.tryDeleteDocument says "If the provided
> reader is an NRT reader obtained from this writer ... then the delete
> succeeds and this method returns true; else, it returns false"
>
> Maybe you need mgrWriter.tryDeleteDocument(DirectoryReader.open(mgrWriter,
> true), 0);
>
>
> --
> Ian.
>
>
> On Tue, May 7, 2013 at 2:05 AM, Reg <register9527@gmail.com> wrote:
> > Hi all,
> >
> > It seems tryDeleteDocument(IndexReader, int) doesn't work with NRTManager
> > while deleteDocuments(Query) works.
> >
> > Here are some sample code snippets:
> >
> > TrackingIndexWriter mgrWriter = new
> NRTManager.TrackingIndexWriter(writer);
> >
> > ReferenceManager<IndexSearcher> mgr = new NRTManager(mgrWriter, new
> > SearcherFactory(), true);
> >
> > mgrWriter.tryDeleteDocument(DirectoryReader.open(writer, true), 0);
> >
> > mgr.maybeRefresh();
> >
> > IndexSearcher searcher = mgr.acquire();
> >
> > searcher.search(query, collector);
> >
> >
> > The deleted doc with id 0 is still returned in collector, but I don't see
> > such issues if I change to mgrWriter.deleteDocuments(Query).
> >
> > Any ideas?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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