No, I mean HitDoc.id, the document number field stored in the HitDoc class. This number is needed when calling IndexReader.delete(int docnum) but it is not publicly accessible.
-- Adrian At 06:32 09/10/2002 -0700, Otis Gospodnetic wrote: >You mean d.get("Id"); ? > >--- [EMAIL PROTECTED] wrote: >> I am just getting started with Lucene and I think I have >> a problem understanding some basic concepts. >> >> I am using two-part identifiers to uniquely identify a >> document in the index. So whenever I want to index a >> document, I first want to find and delete the old form. >> >> To find it, I intend to use: >> >> BooleanQuery findOurs = new BooleanQuery(); >> findOurs.add(new TermQuery(new Term("Id", id)), true, false); >> findOurs.add(new TermQuery(new Term("Domain", domain)), true, false); >> >> System.out.println("Deleting document matching: \"" + >> findOurs.toString("") + '"'); >> >> Searcher searcher = new IndexSearcher(directory); >> Hits hits = searcher.search(findOurs); >> >> // Assert: hits.length() <= 1 >> >> for (int i = 0 ; i < hits.length() && i < 10; i++) { >> Document d = hits.doc(i); >> >> // Now what can I do to find document id? >> >> int id = ?????? >> searcher.delete(id); >> } >> >> But I can't discover how to convert a search result into >> a document id. It is recorded in the private HitDoc >> class, but since it is not publicly accessible, there >> must be a reason why it would not work to add a public >> getter for it. >> >> Is there an alternative way that I can do this? My first >> thought is to define a Field.Keyword("composite-key", >> domain + "\u0000" + id). This would allow me to use the >> delete(Term) interface to delete the key. >> >> -- >> Thanks, Adrian. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>