lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: TrackingIndexWriter.tryDeleteDocument(IndexReader, int) vs deleteDocuments(Query)
Date Tue, 07 May 2013 11:06:01 GMT
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
View raw message