[
https://issues.apache.org/jira/browse/SOLR-18482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121449#comment-18121449
]
Nick Shanin commented on SOLR-18482:
------------------------------------
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
Hi Jan — happy to put up a PR implementing the 400 proposal (rejecting
limit/offset/sort and the other unsupported keys on range facets, naming the
key) if you are not already working on it. Just say the word and I will hold
off.
> JSON range facet silently ignores `limit`, `offset`, `sort` and the refine
> parameters
> -------------------------------------------------------------------------------------
>
> Key: SOLR-18482
> URL: https://issues.apache.org/jira/browse/SOLR-18482
> Project: Solr
> Issue Type: Bug
> Reporter: Jan Høydahl
> Assignee: Jan Høydahl
> Priority: Major
>
> Found by Claude Code
> A {{type: range}} facet in the JSON Facet API accepts {{limit}}, {{offset}},
> {{sort}}, {{prelim_sort}}, {{overrequest}}, {{overrefine}} and {{refine}} and
> ignores them without any error or warning.
> {code:title=POST /solr/techproducts/query}
> {"query":"*:*","limit":0,"facet":{"p":{"type":"range","field":"price",
> "start":0,"end":1000,"gap":250,"limit":1,"offset":1,"sort":"count desc"}}}
> {code}
> returns every bucket in ascending range order — {{limit}}, {{offset}} and
> {{sort}} have no effect. The same request against a {{type: terms}} facet
> honours all three, and the ref guide's examples make the two facet types look
> interchangeable, so users copy these keys across and get a plausible-looking
> wrong answer.
> h3. Cause
> {{FacetRange extends FacetRequestSorted}}, so the request object carries the
> fields, but {{FacetParser.FacetRangeParser.parse}} never reads them from the
> JSON (compare {{FacetFieldParser.parse}}, which does). The map helpers do not
> reject unknown keys, so the values are dropped silently.
> {{FacetRangeProcessor}} never consults them.
> h3. Proposal
> At minimum, reject these keys on a range facet with a 400 naming the key
> ({{sort is not supported on range facets}}), and state in the _Range Facet_
> section of the JSON Facet API page which of the common facet parameters do
> not apply. Implementing sort/paging over range buckets is a possible
> follow-up, but the silent ignore is the bug.
> Found while deriving a JSON Schema of the request DSL from source; the schema
> deliberately omits these keys from range facets so an editor can flag them.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]