-
Notifications
You must be signed in to change notification settings - Fork 381
EDS: Allow limiter-only queries #4976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
| $limit = $this->getParams()->getLimit(); | ||
| $offset = $this->getStartRecord() - 1; | ||
| $params = $this->getParams()->getBackendParameters(); | ||
| if ($allTerms === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could do both conditional checks together, but I thought there might be a performance impact to the array_filter call...though probably not significant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding a paramsIncludeLimiter($params) method so you can check if ($allTerms === '' && !$this->paramsIncludeLimiter($params)) {. Due to the way the && operator works, the second clause will only be evaluated if the first clause evaluates to true, so there should be no performance hit for that approach.
|
This works best when an institution has a least one limiter enabled by default (this being done in the search profile in EBSCOadmin, I think). Our institution has "Available in Library Collection" (FT1) on by default. I would imagine a lot of institutions have the same. |
|
@cwolfebsco would appreciate your review as well! Can't tag you above. |
| if ($allTerms === '') { | ||
| $hasLimiters = (bool)array_filter( | ||
| $params->get('filters') ?? [], | ||
| fn ($filter) => str_starts_with($filter, 'LIMIT') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filter is necessary because some EDS "filters" are actually "expanders", and presumably those don't count in this analysis.
demiankatz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below for a suggestion related to your comment; beyond that, I await input from @cwolfebsco before testing further. :-)
| $limit = $this->getParams()->getLimit(); | ||
| $offset = $this->getStartRecord() - 1; | ||
| $params = $this->getParams()->getBackendParameters(); | ||
| if ($allTerms === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding a paramsIncludeLimiter($params) method so you can check if ($allTerms === '' && !$this->paramsIncludeLimiter($params)) {. Due to the way the && operator works, the second clause will only be evaluated if the first clause evaluates to true, so there should be no performance hit for that approach.
I had a look and I think this is ok, I trust you all way more than I trust myself when it comes to these implementations. Allow me to quickly comment on the expense of the query though. While limiter only searches are technically supported they are quite "expensive" - I often see them take 8 to 12 times longer than other searches, as this short table might be able to confirm (I did run many more tests, of course)
While it likely is ok to move forward, I believe the user is helped more by a clear guiding error message, rather than a result list with potentially limited real world benefit. |
|
I respect @cwolfebsco 's analysis that it slows down the API call considerably. But there are valid use cases for the facets-only search, as evidenced from the discussion a few months back, as well as the fact that the EDS UI still supports it. I don't mind adding a warning-style message and still performing the search, if folks think that's helpful. I.e. "Limiter-only queries can be slow. Add search term(s) to improve performance." In theory we could also put up a speed bump ("are you sure you want to do this limiter-only query"), but I would argue against that as it's a valid search. If we think that level of performance is a problem, I think the solution is caching. In VuFind, the EDS Backend already caches various other interactions besides actual searches, and I could see adding caching for limiter-only queries (if not caching for all queries). Alternatively, if the real concern is server load (not UX), it seems like it's an easy kind of thing to cache on EBSCO's end. |
|
@maccabeelevine, I don't think that displaying a warning about limiter-only searches slowing things down would be very meaningful in the user interface, since in at least some situations this would be telling end-users about the consequences of an administrator's decision. If we want to warn about that, maybe a better approach would be to make limiter-based searching support "opt in" and discuss the trade-offs in the .ini file comments. We could retain the current 11.0 behavior but have a switch that could be flipped to enable the new behavior. Regarding caching, I know that @EreMaijala has implemented search result caching for Solr, but I can't remember all the implementation details. Maybe that mechanism could be extended to cover EDS (if it doesn't already; or otherwise it might at least be used as a model). |
Yes, thank you, I missed that @EreMaijala had done this in #2406, caching at the Connector level. I tested it on limiter-only quries and it works just fine. (The Backend also does its own caching to store the
|
I'll implement this, and suggest enabling the cache if they're going to enable limiter-only queries. |
I quoted @cwolfebsco 's performance stats and suggested caching. I didn't mention the UX reasons to enable it; it's off by default so if someone bothers to look for the config, they will already have a reason to do so. |
| * | ||
| * @var string | ||
| */ | ||
| protected string $configName = 'EDS'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just future-proofing, from lessons learned on Blender2, in case we want to extend it in the future for EPF or whatever else. Currently EPF has no checks on the search query, limiters, etc. @cwolfebsco if that should change, please let me know and we can address it separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maccabeelevine - In /edsapi/publication/search submitting a limiter only query would yield an error 103. Best of my knowledge query is a required parameter for publication search
"DetailedErrorDescription": "Required parameter: query is missing",
"ErrorDescription": "Missing Parameter",
"ErrorNumber": "103"
I might have misunderstood the question though :) Happy New Year!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cwolfebsco . Looks like you're correct on the API but VuFind is still translating empty EPF queries into (FT yes) OR (FT no). I'll deal with that separately: https://openlibraryfoundation.atlassian.net/browse/VUFIND-1816
|
Thanks for the progress and clarification here, @maccabeelevine and @cwolfebsco. It sounds to me like we may need to address the EPF issues first in a separate PR and then circle back to this one. Would you agree? In any case, please let me know if/when you need me to do more reviewing here or elsewhere! |
@cwolfebsco and I are discussing EPF in https://openlibraryfoundation.atlassian.net/browse/VUFIND-1816 I don't think this EDS PR depends on the outcome of the EPF discussion as the default-limiting logic is EDS-only. I've added a unit test, but some more hands-on testing would not hurt. Otherwise I just defer to @cwolfebsco on whether this is ready. |
|
I had a look, looked at the PR on a virtual machine and found it to work as expected. I think this is ready @maccabeelevine and @demiankatz . Thank you so much for being considered, I really appreciate the comments in the EDS.ini for that feature making its impact clear. |
|
I just tested this and the code looks good to me. But I had to perform a search with a non-empty query string, select a filter and then remove the query string. Did I miss an easier way to get to this? If no, I guess, normal users probably will not know, how to do it. |
|
@ThoWagen - EBSCOadmin enables you to define limiters that are applied by default. If that's your setup, this approach would work just fine. |
This partially reverts #4364 , based on discussion afterwards in #vufind-help. @cwolfebsco shared
So this allows searches that have either a query string or a limiter (or both).