Skip to content

Change the first fallback sort field from title (title_sort) to component order (sort_isi) for relevance sort #1585

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

Open
corylown opened this issue Mar 12, 2025 · 3 comments

Comments

@corylown
Copy link
Contributor

If there is no relevance score (when no query is applied to results) it makes more sense to show results in component order (as they appear in the finding aid) rather than by title. Duke has made this change: https://gitlab.oit.duke.edu/dul-its/dul-arclight/-/commit/e6b797af1004795a4f4286d4dd9f10a505269a02

@seanaery
Copy link
Contributor

We have really valued this modification in https://archives.lib.duke.edu because without it a user would encounter a whole lot of ???, --, __, etc. documents while just browsing around. There's really no good reason to emphasize such components
but they're just naturally first when all the components are lexically sorted. I definitely support making this change in core.

@corylown
Copy link
Contributor Author

An alternative to setting the collection's sort_isi value to an arbitrary high number like 999999 is to use a function in the sort to place 0 values last: if(eq(sort_isi,0),0,div(1,field(sort_isi))) desc.

@corylown
Copy link
Contributor Author

corylown commented May 6, 2025

We took a slightly different approach at Stanford. This could be added to Arclight core if it's desirable: sul-dlss/stanford-arclight@cbbf175

It adds sort_isi asc as the first fallback if there's no relevance score. This means when results are not grouped collections and no query or facets are applied collections appear first in alphabetical order by title. If a collection facet is applied the collection appears first followed by all it's components in component order.

config.add_sort_field 'relevance', sort: 'score desc, sort_isi asc, title_sort asc', label: 'relevance'

When group is applied (and no query is present) we apply a sort.group parameter set to a function that effectively returns all the components in component order with the collection last. The nice thing about this is that the groups all use the plain sort parameter so the groups are ordered by collection title.

solr_parameters['group.sort'] = 'if(eq(sort_isi,0),0,div(1,field(sort_isi))) desc'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants