FAQ
Hi,

I tried 3-4 ways to delete a document but still no results. I am using
Lucene 3.1

I used writer.UpdateDocuments(Term term, Document d)
as well as write.addDocument(d); and after that writer.deleteDocuments(d);

Using both I am not able to delete the previous document.

Is there any problem in my code?

String q1 = contract.getDocId();
Term term = new Term(contract.getDocId()); // where DocId is my field
try {
writer.deleteDocuments(term);
System.out.println("Deleting Document with the term "+term);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use
File | Settings | File Templates.
}
d.add(new Field("DocId",q1,Field.Store.YES,Field.Index.NOT_ANALYZED));
writer.addDocument(d);
writer.optimize() ;
writer.close();


Same is the result when I use writer.updateDocument(term,d)

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 8 | next ›
Discussion Overview
groupjava-user @
categorieslucene
postedJun 10, '11 at 8:25a
activeJun 10, '11 at 12:37p
posts8
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase