Set default sort order on IIIF collection searches#351
Merged
kdid merged 1 commit intodeploy/stagingfrom Mar 18, 2026
Merged
Conversation
mathewjordan
approved these changes
Mar 16, 2026
Member
mathewjordan
left a comment
There was a problem hiding this comment.
Looks great and works well for me!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sumamry
Fix duplicate items in paginated IIIF collection responses
When requesting pages of a IIIF collection (e.g.
?as=iiif&page=2), items would sometimes appear on multiple pages. Because all works matchingcollection.id:{id}receive equal relevance scores, OpenSearch returned them in an arbitrary shard-merge order that was not guaranteed to be stable between requests.The fix applies a default
accession_number:ascsort to IIIF collection searches. This is done via a newdefaultSortoption ondoSearchthat is applied to the search context after query construction but before the OpenSearch request - keeping it out of query string parameters and pagination URLs, and leaving all other search paths unaffected. An explicit?sort=parameter from the caller will still take precedence.To test/verify
Using the tool: https://nulib-labs.github.io/debug-dcapi-paging/