I have a delete script
IndexSearcher searcher = new IndexSearcher(reader);
Hits hits = searcher.search(query);
log.info("there are " + hits.length() + " hits");
for (int i = 0; i < hits.length(); i++) {
log.info(hits.length() + " " + i + " " + hits.id(i));
reader.delete(hits.id(i));
}
which iterates through the results of a search and deletes the returns. I keep
getting an ArrayIndexOutOfBoundsException. I've found the reason is that
hits.length() actually changes during the iteration in large regular steps i.e
The hits length is initially 10003
after 100 deletions hits.length() changes to 9903
after 200 deletions hits.length() changes to 9803
then changes after
200 deletions
400
800
1600
3200
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)?
cheers.
David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]