Well, taking the code all together, what I expect is that you'll have a document after all is done that only has a "DocId" in it. Nowhere do you fetch the document from the index.
What is your evidence that you haven't deleted the document? If you haven't reopened your reader after the above, you'll see the old view of the index, so be sure you close/open your searcher afterwards. Ian's suggestion is the best I think, since the code fragments you've provided don't tell the complete story. If there's an error in contract.getDocID(), we can't see it to help. It might help to review: http://wiki.apache.org/solr/UsingMailingLists Best Erick On Fri, Jun 10, 2011 at 7:34 AM, Ian Lea <ian....@gmail.com> wrote: > In different code samples you've got both DocId and DocID. If that > isn't the problem I suggest you post a complete little program that > demonstrates the problem. As small as possible, no external > dependencies. > > > -- > Ian. > > > On Fri, Jun 10, 2011 at 12:24 PM, Pranav goyal > <pranavgoyal40...@gmail.com> wrote: >> 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 <dannyl...@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 -- >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org