-
Notifications
You must be signed in to change notification settings - Fork 381
Implement getScores() and getMaxScore() for EDS results #4807
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
Conversation
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.
Thanks, @maccabeelevine -- see below for some more food for thought.
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.
@maccabeelevine, thanks for the improvements. I think this looks pretty good -- but see below for one nagging concern. If that's not really an issue, we can probably merge this, but I wanted to discuss first just in case! :-)
| if (empty($this->results)) { | ||
| return null; | ||
| } | ||
| return $this->results[0]->getScore(); |
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.
Presumably this only works if we have a relevance-descending sort. Maybe that's the only time that we need it to work. But are there other cases we need to worry about?
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.
Good catch. In my use case (#4806) I would probably only care in the context of a relevancy sort, but other uses might care about other sorts. The behavior I'm seeing from the EDS API is that it doesn't actually calculate a real relevancy score if you have any other sort, however it returns zero for every result instead of just omitting the score. For the purposes of our API, it's better to return null in that situation.
| { | ||
| if ( | ||
| empty($this->results) || | ||
| 'relevance' != $this->getParams()->getSort() |
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 theoretically leaves open the absurd case of sorting by least-relevant first, but looking at the way EDS does sort key naming I think that would actually have a different name, something like "relevance2". If it is even supported by the API, which (hopefully) it's not. All the API docs tell you is that you can see available sort options from the /info endpoint, and so for my instance there's no reverse-sort option, but it's possible that I could turn it on somewhere in EBSCOadmin if I dared to look.
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'm willing to live with the assumption that we won't have to deal with this scenario.
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.
Looks good to me now. Thanks, @maccabeelevine!
These functions are stub defined in Search/Base/Results, and overridden only for Solr. Implement them for EDS Results.