SOLR-14607: LTR Query, the TimeAllowed parameter causes a timeout exception after no results
Description
When timeAllowed parameter is set, the SolrQueryTimeoutImpl function will be started to detect whether it has timed out when the term is loaded. When overtime, an ExitingReaderException is thrown.
In the process of scoreFeatures of LTRQuery, ExitingReaderException will occur in two stages.
- scorer: Occurs when a term needs to be loaded to the LeafReaderContext when creating Weight.
- score: The term needs to be loaded when some functions call getValue. For example, FloatPayloadValueSource.
So it can be compatible with this ExitingReaderException, and partly return. At least it's better than empty.
Solution
In scoreFeatures method, catch ExitingReaderException and return the currently loaded document.
Tests
Simulation throws ExitingReaderException in the scorer process, and partially returns the loaded document. Simulation throws ExitingReaderException in the score process of Feature, partially returning the calculated document.
Checklist
Please review the following and check all that apply:
- [x] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
- [x] I have created a Jira issue and added the issue ID to my pull request title.
- [x] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
- [x] I have developed this patch against the
masterbranch. - [x] I have run
ant precommitand the appropriate test suite. - [x] I have added tests for my changes.
@cpoerschke I have resubmitted it. Please review this PR again, thanks.
@alessandrobenedetti Add a parameter to LTR that lets the user choose what to do with the timeout? What do you think?
@alessandrobenedetti Add a parameter to LTR that lets the user choose what to do with the timeout? What do you think?
mmm personally I don't think it is useful to have some results reranked and some not, depending on a time-out and with little control over knowing "up to what" was reranked. So, in my opinion, I would not add it as a parameter, it will just add unnecessary complexity.
This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the [email protected] mailing list. Thank you for your contribution!
This PR had no visible activity in the past 60 days, labeling it as stale. Any new activity will remove the stale label. To attract more reviewers, please tag someone or notify the [email protected] mailing list. Thank you for your contribution!