lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pranav goyal <pranavgoyal40...@gmail.com>
Subject Updating a document
Date Fri, 10 Jun 2011 08:24:16 GMT
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)

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