Skip to content

SOLR-18482: Reject unsupported parameters on JSON range facets - #5009

Open
nick-boss-tech wants to merge 4 commits into
apache:mainfrom
nick-boss-tech:solr-18482-submit
Open

nick-boss-tech wants to merge 4 commits into
apache:mainfrom
nick-boss-tech:solr-18482-submit

Conversation

@nick-boss-tech

@nick-boss-tech nick-boss-tech commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🤖 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, or refine on 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

FacetRangeParser now 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 a SolrException for 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, or refine to 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.yml

AI assistance

AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.

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.
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests cat:search labels Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:search documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant