Reputation: 3368
I'm using solr and search on distributed lucene indices over network. I send queries from arbiter to searchers (solr) and then get the result.
Some of queries take a lot of time (more than a minute) to be finished on searchers and slow down the search for other queries.
How can I set a timeout for solr so that if a query takes more than a specified time, it cancels the search?
Upvotes: 3
Views: 14036
Reputation: 3368
setTimeAllowed function does it!
public SolrQuery setTimeAllowed(Integer milliseconds)
Set the maximum time allowed for this query. If the query takes more time than the specified milliseconds, a timeout occurs and partial (or no) results may be returned. If given Integer is null, then this parameter is removed from the request
Parameters:
milliseconds - the time in milliseconds allowed for this query
Upvotes: 4