The solution you suggested works fine. Thanks a lot for your help.

dhruba


From: Morus Walter <[EMAIL PROTECTED]>
Reply-To: "Lucene Users List" <[EMAIL PROTECTED]>
To: "Lucene Users List" <[EMAIL PROTECTED]>
Subject: Re: Re:can't delete from an index using IndexReader.delete() Date: Fri, 20 Feb 2004 10:33:08 +0100


Dhruba Borthakur writes:
> Hi folks,
>
> I am using the latest and greatest Lucene jar file and am facing a problem
> with
> deleting documents from the index. Browsing the mail archive, I found that
> the
> following email (June 2003) listed the exact problem that I am encountering.
>
> In short: I am using Field.text("id", "value") to mark a document. Then I
> use
> reader.delete(new Term("id", "value")) to remove the document: this
> call returns 0 and fails to delete the document. The attached sample program
> shows this behaviour.
>
You don't tell us how your ids look like, but Field.text("id", value)
tokenizes value, that is splits value into whatever the analyzer considers
to be a token, and creates a term for each token.
Whereas new Term("id", value) creates one term containing value.


So I guess your ids are considered several token by the analyzer you use
and therefore they won't be matched by the term you construct for the delete.


Using keyword fields instead of text fields for the id should help.

Morus

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


_________________________________________________________________
Find and compare great deals on Broadband access at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/



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



Reply via email to