I think the Collector approach makes the most sense to me, since
it's the only object I fully control in the search process. I cannot
control Query implementations, and I cannot control the decisions
made by IndexSearcher. But I can always wrap someone else's
Collector with TLC and pass it to search().
Isn't another option to have a TimeLimitedIndexReader?
Clients would need to make a call before the start of any timeout-able
activity e.g.
timeLimitedReader.startActivity(MAX_ALLOWED_DURATION); //sets a
ThreadLocal
//run query etc
All invocations on special IndexReader, TermEnum, TermDocs etc
subclasses can then periodically check to see if the calling thread
has exceeded its allotted time. This would be a potentially non-
invasive way of making all filters', queries', scorers' etc read
activity subject to some time limit as they all typically have to
invoke IndexReader-related classes relatively frequently as part of
their processing.
Not sure how quick you can make all the underlying time checks though.
Cheers,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org