Hi,

I have put this question as "urgent" because I can notice I don't have
often answers,
If I'm asking the wrong way, please tell me...


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),

But there is something very odd happing sometimes :

I find a hit, but the integer returned by deleteDocuments is equal to 0
This often happens after I merged the index for the first time,
it never happens before I merge ...



Term urlTerm = new Term("url", urlToDel);
Query query = new TermQuery(urlTerm);

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 old entry failed",
                        e);
        }


What I get sometimes is :

found in the index
0 doc deleted


__________________________________

   Matt



============================================
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