Mailing List Archive

Re: Deleting problem
Hi.

Maybe it's the same problem that I asked for and Otis Gospodnetic has just
answered (Many thanks !) :

If your analyzer convert tokens to lower case, then you must use lower case
value to search with IndexReader.
You can see it with TermEnum and look at values taht are really stored in
the index ...


----- Original Message -----
From: "Stephan J. Schmidt" <stephan.schmidt@neotis.de>
To: <lucene-user@jakarta.apache.org>
Sent: Wednesday, December 19, 2001 4:17 PM
Subject: Deleting problem


> Hi,
>
> I have problems deleting documents from the index.
> The documents are indexed with an unique OID. Searching
> for this OID returns some documents but deleting
> this OID returns 0 for deleted documents.
>
> Searcher searcher = new
IndexSearcher("/opt/server/neotis/solent/kindex");
>
> String oidString = "E78180808080808080808080808080neotis";
> Query query = QueryParser.parse(oidString, "OID", new
OIDAnalyzer());
>
> Hits hits = searcher.search(query);
>
> int start = 0;
> final int HITS_PER_PAGE = 10;
> int end = Math.min(HITS_PER_PAGE, hits.length());
>
> // Documents are found here
> for(int i = start; i < end; i++) {
> System.out.println(hits.doc(i).get("Name")+"
OID:"+hits.doc(i).get("OID"));
> }
>
> searcher.close();
>
> // Returns "0" for deleted documents and documents are not deleted
> IndexReader reader =
IndexReader.open("/opt/server/neotis/solent/kindex");
> System.err.println("Deleted: " + reader.delete(new Term("OID",
oidString)))
>
> Thanks,
> bye
> -stephan
>
>
> --
> To unsubscribe, e-mail:
<mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>