>> Is that the same reader that is used in IndexSearcher?

I opened an IndexSearcher on the path (String) to the index.
Now I tried to open on the clone IndexReader and use the constructor
that has an IndexReader as param, 
and I got everything working now ....

I just have two IndexSearchers opened now most of the time, which is
deprecated,
But I think that's my only choice !

Thank u !

__________________________________
   Matt

    

-----Original Message-----
From: Antony Bowesman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 13, 2007 10:13 PM
To: java-user@lucene.apache.org
Subject: Re: [Urgent] deleteDocuments fails after merging ...

*****  This message comes from the Internet Network *****

Erick Erickson wrote:
> The javadocs point out that this line
> 
> * int* nb = mIndexReaderClone.deleteDocuments(urlTerm)
> 
> removes*all* documents for a given term. So of course you'll fail
> to delete any documents the second time you call
> deleteDocuments with the same term.

Isn't the code snippet below doing a search before attempting the
deletion, so 
from the IndexReader's point of view (as used by the IndexSearcher) the
item 
exists.  What is mIndexReaderClone?  Is that the same reader that is
used in 
IndexSearcher?

I'm not sure, but if you search with one IndexReader and delete the
document 
using another IndexReader and then repeat the process, I think that the
search 
would still result in a hit, but the deletion would return 0.

> On 3/13/07, DECAFFMEYER MATHIEU <[EMAIL PROTECTED]> wrote:
>>
>> Before I delete a document I search it in the index to be sure there
is a
>> hit (via a Term object),
>> When I find a hit I delete the document (with the same Term object),

>> Hits hits = search(query);
>> *if* (hits.length() > 0) {
>>        * if* (hits.length() > 1) {
>>                 System.out.println("found in the index with
duplicates");
>>         }
>>         System.out.println("found in the index");
>>        * try* {
>>                * int* nb =
mIndexReaderClone.deleteDocuments(urlTerm);
>>                * if* (nb > 0)
>>                         System.out.println("successfully deleted");
>>                * else*
>>                        * throw** new* IOException("0 doc deleted");
>>         }* catch* (IOException e) {
>>                 e.printStackTrace();
>>                * throw** new* Exception(
>>                         Thread.currentThread().getName() + " ---
Deleting

Antony


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



============================================
Internet communications are not secure and therefore Fortis Banque Luxembourg 
S.A. does not accept legal responsibility for the contents of this message. The 
information contained in this e-mail is confidential and may be legally 
privileged. It is intended solely for the addressee. If you are not the 
intended recipient, any disclosure, copying, distribution or any action taken 
or omitted to be taken in reliance on it, is prohibited and may be unlawful. 
Nothing in the message is capable or intended to create any legally binding 
obligations on either party and it is not intended to provide legal advice.
============================================


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

Reply via email to