Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

IndexReader.deleteDocument(Term) in Lucene 3.6/4.0

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


nikolazius at gmail

May 25, 2012, 5:45 AM

Post #1 of 3 (324 views)
Permalink
IndexReader.deleteDocument(Term) in Lucene 3.6/4.0

Hi everyone. We are using IndexReader.deleteDocument(Term) method to
delete documents, since it returns the number of deleted documents.
This is used to be sure that some docs were removed. We must know for
sure if documents were deleted. But in lucene 3.6 this method is final
and can't be overridden in our codebase anymore. Method
IndexWriter.deleteDocument(..) is not final and possibly can be used
in our project, but doesn't return any value so we can't be sure
whether ant documents were deleted. So briefly
IndexReader.deleteDocument(Term) is a final but returns number of
deletions performed and IndexWriter.deleteDocument(..) is not final,
but doesn't return any result. Our functionality requires overriding
and result value.

Can anyone please suggest how to solve this issue? Can simply run term
query before, but it seems to be absolutely inefficient.

--
Best regards, Nikolay Zamosenchuk

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


simon.willnauer at googlemail

May 25, 2012, 5:59 AM

Post #2 of 3 (319 views)
Permalink
Re: IndexReader.deleteDocument(Term) in Lucene 3.6/4.0 [In reply to]

hey,

On Fri, May 25, 2012 at 2:45 PM, Nikolay Zamosenchuk
<nikolazius [at] gmail> wrote:
> Hi everyone. We are using IndexReader.deleteDocument(Term) method to
> delete documents, since it returns the number of deleted documents.
> This is used to be sure that some docs were removed. We must know for
> sure if documents were deleted. But in lucene 3.6 this method is final
> and can't be overridden in our codebase anymore. Method
> IndexWriter.deleteDocument(..) is not final and possibly can be used
> in our project, but doesn't return any value so we can't be sure
> whether ant documents were deleted. So briefly
> IndexReader.deleteDocument(Term) is a final but returns number of
> deletions performed and IndexWriter.deleteDocument(..) is not final,
> but doesn't return any result. Our functionality requires overriding
> and result value.
>
> Can anyone please suggest how to solve this issue? Can simply run term
> query before, but it seems to be absolutely inefficient.

what you can do is use IndexReader#docFreq(Term) to figure out
documents that have been deleted / will be deleted by you delete term

simon
>
> --
> Best regards, Nikolay Zamosenchuk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


uwe at thetaphi

May 25, 2012, 6:02 AM

Post #3 of 3 (320 views)
Permalink
RE: IndexReader.deleteDocument(Term) in Lucene 3.6/4.0 [In reply to]

To change the behaviour of IndexReaders use FilterIndexReader, don't
subclass IndexReader's directly.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe [at] thetaphi


> -----Original Message-----
> From: Nikolay Zamosenchuk [mailto:nikolazius [at] gmail]
> Sent: Friday, May 25, 2012 2:45 PM
> To: java-user [at] lucene
> Subject: IndexReader.deleteDocument(Term) in Lucene 3.6/4.0
>
> Hi everyone. We are using IndexReader.deleteDocument(Term) method to
> delete documents, since it returns the number of deleted documents.
> This is used to be sure that some docs were removed. We must know for sure
if
> documents were deleted. But in lucene 3.6 this method is final and can't
be
> overridden in our codebase anymore. Method
> IndexWriter.deleteDocument(..) is not final and possibly can be used in
our
> project, but doesn't return any value so we can't be sure whether ant
> documents were deleted. So briefly
> IndexReader.deleteDocument(Term) is a final but returns number of
deletions
> performed and IndexWriter.deleteDocument(..) is not final, but doesn't
return
> any result. Our functionality requires overriding and result value.
>
> Can anyone please suggest how to solve this issue? Can simply run term
query
> before, but it seems to be absolutely inefficient.
>
> --
> Best regards, Nikolay Zamosenchuk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.