lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doron Cohen" <cdor...@gmail.com>
Subject Re: Deleting and adding docs
Date Sat, 09 Aug 2008 13:33:35 GMT
>
> doc.add(new Field(ID_FIELD, id, Field.Store.YES, Field.Index.NO));
> writer.deleteDocuments(new Term(ID_FIELD, id));
> int i = reader.deleteDocuments(new Term(ID_FIELD, id)); //i returns 0
> Both failed. I try to delete one id value that I know for sure it was added
> in the first step.
>

For deleting by term it needs to be searchable, that is - indexed.
This should work the deletions:
  doc.add(new Field(ID_FIELD, id, Field.Store.YES,
Field.Index.UN_TOKENIZED));

Doron

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message