paulirwin opened a new pull request, #1080:
URL: https://github.com/apache/lucenenet/pull/1080

   - [X] You've read the [Contributor 
Guide](https://github.com/apache/lucenenet/blob/main/CONTRIBUTING.md) and [Code 
of Conduct](https://www.apache.org/foundation/policies/conduct.html).
   - [ ] You've included unit or integration tests for your change, where 
applicable.
   - [X] You've included inline docs for your change, where applicable.
   - [X] There's an open issue for the PR that you are making. If you'd like to 
propose a change, please [open an 
issue](https://github.com/apache/lucenenet/issues/new/choose) to discuss the 
change or find an existing issue.
   
   Adds basic cancellation support to IndexSearcher.
   
   Fixes #922
   
   ## Description
   
   This adds optional CancellationToken parameters to all 
`IndexSearcher.Search` and `SearchAfter` methods, which is a breaking change to 
the API.
   
   If an executor is provided in the constructor for multithreaded search, then 
the provided CancellationToken is passed to the `Task.Wait(CancellationToken)` 
method. If an executor is not provided, then it will call 
`ThrowIfCancellationRequested()` in the synchronous case at the evaluation of 
each leaf reader context.
   
   This will not help cancellation for i.e. single-leaf reader contexts that 
might take a while to complete (that would require a much larger and messier 
change to add CancellationToken support to Scorer and ICollector, and 
benchmarking to ensure we don't hurt performance by doing so), but should at 
least help with many scenarios that require cancellation.
   
   I wanted to publish this draft PR for feedback; please let me know if you 
like this direction or have concerns.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to