lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pranav goyal <pranavgoyal40...@gmail.com>
Subject Re: Updating a document
Date Fri, 10 Jun 2011 11:24:49 GMT
Hi Danny,

I have explained it above.

It has many fields out of which DocId is the field which I am storing as
well as indexing. While other fields I am just storing.
And Each document has unique DocId.

d=new Document();
File indexDir = new File("./index-dir");
StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_31);
IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_31, analyzer);
try {
      writer = new IndexWriter(FSDirectory.open(indexDir),conf);
} catch (IOException e1) {
     e1.printStackTrace();
}
String q1 = contract.getDocId();    // Here I am getting my DocId
Term term = new Term("DocID",contract.getDocId());


Rest I have stated above.



On Fri, Jun 10, 2011 at 4:44 PM, Danny Lade <dannylade@googlemail.com>wrote:

> You delete it first using your id:
>
> >            writer.deleteDocuments(term);
> >
>
> and then re-add it with the same id:
>
> writer.addDocument(d);
> >
>
> Please explain:
> How looks your document BEFORE you try to delete it? (Which fields has it?)
>
> Greetings Danny
>



-- 
I'm very responsible, when ever something goes wrong they always say I'm
responsible --

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