lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Removing indexed document
Date Tue, 04 Nov 2003 11:26:23 GMT
On Tuesday, November 4, 2003, at 05:16  AM, Ricardo Coutinho wrote:
> This is my code for the delete
>
> TermEnum uidIter = reader.terms(new Term("uri",
> "jdbc://theHost/thePath#uuid=8c5419bc0a28645e0089db9a0000016b");
> while(uidIter.next())
> {
> 	Term t = uidIter.term();
> 	getLogger().debug("unindexing text() " + t.text());
>
> 	reader.delete(t);
> }
>
> My debug statement shows me that it deletes the wrong document...
> 10:59:30,577 DEBUG [DocumentIndexerService] unindexing text()
> jdbc://theHost/thePath#uuid=8dc8946e0a28645e01a428240000000e

If you only want to delete a single document, why are you iterating?   
What you are doing is starting the enumeration at the term from  
reader.terms() and then deleting all documents from there forward,  
except you are doing a .next() first and skipping the one you really  
wanted to delete.  To delete just the one you want, do this:

  	reader.delete(new  
Term("uri","jdbc://theHost/ 
thePath#uuid=8c5419bc0a28645e0089db9a0000016b"))

	Erik


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


Mime
View raw message