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)

Reply via email to