Use case-insensitive collation as default for Mongo pagination#25808
Open
dennisoelkers wants to merge 5 commits intomasterfrom
Open
Use case-insensitive collation as default for Mongo pagination#25808dennisoelkers wants to merge 5 commits intomasterfrom
dennisoelkers wants to merge 5 commits intomasterfrom
Conversation
Adds a default case-insensitive collation to DefaultMongoPaginationHelper so callers get case-insensitive, numeric-aware sorting without per-query workarounds. PaginatedStreamService drops its manual $toLower field transformation in favor of the shared collation.
399a78f to
3d0ffd3
Compare
…collation Filter cases now use `_id` so the string collation does not widen the match set, and the sort cases expect upper/lower case entries to be interleaved with `_id` ASC breaking ties regardless of sort direction. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Description
Adds a default case-insensitive, numeric-aware
CollationtoDefaultMongoPaginationHelperand uses it whenever a caller does not supply its own collation.PaginatedStreamServicedrops its manual$toLowerpipeline stages in favor of the shared collation.Motivation and Context
Case-insensitive sorting was previously bolted onto
PaginatedStreamServiceby projecting a lowercased copy of the sort field through an aggregation pipeline. Other paginated endpoints had no case-insensitive sorting at all. Centralizing a sensible default collation removes the per-call workaround and makes sort order consistent across paginated APIs.numericOrderingadditionally gives natural ordering for titles containing numbers (e.g.Stream 2beforeStream 10).Fixes Graylog2/graylog-plugin-enterprise#12877
How Has This Been Tested?
Manual verification against the streams listing API. Existing
DefaultMongoPaginationHelperTest/…WithPipelineTeststill pass.Screenshots (if appropriate):
Types of changes
Checklist: