Author drop-down on edit form does not prioritise the most likely match
The author dropdown seems to prioritise the least likely match over the most likely match. It's difficult to be certain what someone wants when there are multiple matches, but perhaps prioritising exact match + # of works [and maybe] lower ID will help.
Evidence / Screenshot (if possible)
Steps to Reproduce
- Go to ...edit work
- Do ...add charles dickens to authors
- Actual: The least likely choice is the first option.
- Expected: The most likely choice should be the first option.
Details
- Logged in (Y/N)?
- Browser type/version?
- Operating system?
- Environment (prod/dev/local)? prod
Proposal & Constraints
Related files
Stakeholders
@cdrini
Hey @cdrini I noticed this has been open for some time and I have investigated it. Just want to share my findings before proposing a direction.
Looking at authors_autocomplete in plugins/worksearch/autocomplete.py, the class inherits sort = None from the base autocomplete class and never overrides it. No sort and no boost function are passed to Solr, so results come back in default relevance order which does not account for work count at all. work_count is already in f1 so it's being fetched, and I confirmed it is indexed and sortable in conf/solr/conf/managed-schema.xml (type pint, indexed and stored).
I think there are two options, the first of which is to add sort = 'work_count desc' to authors_autocomplete. It's consistent with how subjects autocomplete works, however, it is a pure popularity sort. It would always rank the most prolific author first regardless of how well their name matches the query. The second option is to switch authors_autocomplete to edismax and add bf=min(work_count,20). That would keep relevance as the primary signal while letting work count influence results up to a cap. The tradeoff is that it's a more involved change since the current query is written in lucene syntax with explicit field references. There is also the question of scope (whether this goes on the base class or just authors_autocomplete since the other subclasses would be affected if it goes in the base)
My hunch is option 2 but I wanted to check first. Would you be happy with that approach? Happy to take this on and be assigned!
@cdrini just following up on this. Would love to work on it!
Hi @Saad259 apologies for delay! Exactly, I believe we wouldn't want just a raw work count sort. Using edismax seems very reasonable! I wonder if we might actually change autocomplete to use the default author search scheme class? Not sure, but potentially worth investigating if you still have bandwidth/interest in this one.