You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Otis Gospodnetic <ot...@yahoo.com> on 2002/01/11 04:23:51 UTC

Re: Deleting problem

I'm not sure if you got an answer to your question nor whether this is
going to be a correct answer, but have you tried calling isDeleted() on
those documents that you are printing out in that for loop?  Could it
be that they are already deleted?
What happens if you optimize the index first and then run this code?

Otis


--- "Stephan J. Schmidt" <st...@neotis.de> wrote:
> 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:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>