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 Aruna Raghavan <Ar...@opin.com> on 2002/04/17 20:09:16 UTC

Search question

Hi,
I am looking for ways to cancel a search in response to a cancel from a user
interface. I don't see any thing like a timeout on the Searcher.search()
method. Is there a way to terminate a search request?
Aruna Raghavan
Senior Software Engineer
OPIN Systems SPC

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Search question

Posted by Ype Kingma <yk...@xs4all.nl>.
Aruna,

>Hi,
>I am looking for ways to cancel a search in response to a cancel from a user
>interface. I don't see any thing like a timeout on the Searcher.search()
>method. Is there a way to terminate a search request?

You can use the low level search api with a collector that checks for
cancelling and throw an appropriate error when it occurs.
In case the cancel is detected by another thread you could
make it interrupt the thread running the collector.

However, since searching is quite fast I found no need to interrupt search().
I check for user cancel during retrieval of search results
and also just before starting the query in the next database.

Regards,
Ype

-- 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>