SOLR-18482: Reject unsupported parameters on JSON range facets - #5009
Open
nick-boss-tech wants to merge 4 commits into
Open
nick-boss-tech wants to merge 4 commits into
nick-boss-tech wants to merge 4 commits into
Conversation
Range facets accepted limit, offset, sort, prelim_sort, overrequest, overrefine and refine and silently ignored them, while terms facets honour them. FacetRangeParser now rejects each of them with a 400 naming the parameter, checked in a fixed order so the error is the same when several are present. The ref guide Range Facet section lists the parameters that do not apply.
Explicit ranges are returned in the order they were requested, not in ascending range order; only start/end/gap buckets are ascending.
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.
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
https://issues.apache.org/jira/browse/SOLR-18482
What happens today
JSON range facets silently ignore terms-facet parameters that have no meaning for them. A request can carry
limit,offset,sort,prelim_sort,overrequest,overrefine, orrefineon a range facet and gets back the full, unsorted result with no signal that the parameters did nothing. A user who thinks they paged or sorted their range buckets has no way to notice the mistake.What this change does
FacetRangeParsernow rejects any of those seven parameters on a range facet with a 400 error naming the parameter: " is not supported on range facets". The check order is fixed, so the parameter named in the error is the same when several unsupported parameters are present. This is a deliberate compatibility change: requests that were silently accepted before now fail, which is what the ticket proposes.Proof
Verified on the fork's GitHub Actions test runner at head 8ef833b on 2026-10-04, with Error Prone enabled; the base-code comparisons ran the same test classes against a tree with base production code and this PR's test files.
TestJsonFacetErrors: 5 of 5 pass with this change. On base code, its range-facet error cases fail: they expect aSolrExceptionfor the unsupported parameters and none is thrown.TestJsonRangeFacets: 10 of 10 pass with this change. The same class also passes on base code: those cases pin the accepted range-facet behavior, which this change does not alter.Limits
Only range facets are covered; other facet types still ignore parameters they do not support. A parameter outside the seven named above is still ignored on range facets.
Upgrade note
Clients that attach
limit,offset,sort,prelim_sort,overrequest,overrefine, orrefineto a JSON range facet now get a 400 error instead of having those parameters silently ignored. This includes clients that build facet JSON generically and attach the same parameters to every facet. Remove those parameters from range facet definitions before upgrading.Changelog:
changelog/unreleased/SOLR-18482-range-facet-unsupported-params.ymlAI assistance
AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.