lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: [Urgent] deleteDocuments fails after merging ...
Date Tue, 13 Mar 2007 16:50:55 GMT
Well, don't label things urgent. Since this forum is is free, you have
no right to demand a quick response.

You'd get better responses if there was some evidence that you
actually tried to find answers to your questions before posting
them. We all have other duties, and taking time out to answer
what look like questions that reflect minimum effort on your part
gets a very low priority.

Even a casual look at your code reveals a major problem, more
evidence that you aren't doing very much work before yelling
for help, thus going on the low-priority list.

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.

Which is further evidence that your statement
"it never happens before I merge" shows that you haven't, for instance,
stepped through your code in a debugger trying to figure out what's
going on. If you had, you'd have noticed that the code always failed
on the second call. Which may have lead you to the answer for
yourself.

My overall point is that you seem to be treating this forum
as your personal help desk, with nothing better to do than
answer your questions as soon as they occur to you. This is
certainly the way many of your posts strike me.

Someone posted this URL a while back. While I think it's far
ruder than necessary, it does provide insights into asking for
help from free forums. I think you would get some valuable
information from it.

http://www.linuxforums.org/forum/linux-newbie/6322-asking-good-questions-2-a.html

Erick




On 3/13/07, DECAFFMEYER MATHIEU <MATHIEU.DECAFFMAYER@fortis.lu> wrote:
>
>
> 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: 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