lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <>
Subject Re: hits.length() changes during delete process.
Date Mon, 06 Dec 2004 08:03:40 GMT
David Townsend writes:
> So the short question is, should the hits object be changing and what is the best way
to delete all the results of a search (it's a range query so I can't use delete(Term term)?

The hits object caches only part of the hits (initially the first 100 (?)). 
This cache is extended if further hits are accessed by repeating the search. 
Since you deleted part of the hits at this point, your hits object changes.
You should be able to get around this by either scanning the hits objects
from end to start instead of start to end or deleting with a different
index reader. In the latter case the searcher should not see the deletions.
Reversing the order might be preferable, since it implies only one search
(both suggestions untested)

The "best" way would probably be, to avoid a hit object anyway and delete
the documents at the level where the hits object is created. Have a look
at the sources for details. (also untested; I never needed more than 
term based deletions)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message