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 Sven-Teichmann <s....@s4ip.de> on 2014/10/13 16:51:47 UTC

Abort a search

Hi,
 
I try to find a way to abort a running search.
 
I am aware of the TimeLimitingCollector, but in my case this will not help at
all. The problem is, that I have to cancel very complex and long running
searches, which might never find something. Because they do not find something,
the collect method of the TimeLimitingCollector won't be called and therefore
the search will never be aborted.
 
The only way I found to do this is to run the search in an extra thread and if
it is not finished within a given time, kill the thread with Thread.stop(). What
happens to IndexReaders/Searchers in this case (we are using MMapDirectory)?
 
Is there a way to cleanly abort a running search?
 
Sven Teichmann