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]

Reply via email to