[
https://issues.apache.org/jira/browse/BLUR-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13553750#comment-13553750
]
Aaron McCurry commented on BLUR-46:
-----------------------------------
This is a good question.
The QueryArg object contains the id that will uniquely identify the running
within the given Session. I think the best place to maintain a collection
(probably a map) of the currently running queries is in the SessionInfo object
(see the BlurServer class). In the search method (in BlurServer) you will have
to record when the query starts (in the SessionInfo) and when it finishes.
Then in the cancelQuery method using the session object and the id you should
be able to locate the running query. The tricky part is actually getting the
query to stop executing because interrupt won't do it. There are 2 phases to a
Lucene query that we have to account for during the cancel.
1. Stopping the rewriting of a query, this may not be as important as it once
was because of the massive improvements to Lucene fuzzy queries and the like.
2. Stopping the actual query execution, meaning while the collector is in use.
In the past I have had to create an AtomicBoolean that I would use to exit the
running queries and I would use the same instance in both phases. But to stop
phase #1 I had to wrap the IndexReader and wrap all the of the TermEnum object
to get them to finish the rewrite eariler (I can point you to that code in
0.1.x). As for phase #2 I used a collector that would throw an exception once
the AtomicBoolean was triggered. Would love to hear other thoughts on
techniques on exiting a Lucene query earlier.
Aaron
> Implement cancelQuery
> ---------------------
>
> Key: BLUR-46
> URL: https://issues.apache.org/jira/browse/BLUR-46
> Project: Apache Blur
> Issue Type: Improvement
> Affects Versions: 0.2.0
> Environment: 0.2-dev-removing-old-thrift branch
> Reporter: Aaron McCurry
> Fix For: 0.2.0
>
>
> Implement the ability to cancel any currently running queries via
> cancelQuery. The thrift api will likely evolve during implementation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira