FieldFacet#to_params emits the :matches option as a global facet.matches param:
params[:"facet.matches"] = @options[:matches] if @options[:matches]
Solr scopes an unqualified facet param to every facet.field in the request, so when one request facets several fields with different patterns, one pattern wins and applies to all of them. Demonstrated against Solr 8.11.4 with two facet fields and one pattern meant for the first: the second field returned no rows under the global param, and the correct rows once each field carried its own f.<field>.facet.matches.
Sunspot already solves this for facet.prefix through qualified_param; :matches should be emitted the same way, with a spec asserting that two facets in one request keep distinct patterns.
Downstream today this is latent — Glint builds every facet's pattern from the same typed prefix, so the patterns coincide — but it bites the first time two facets in a request legitimately differ.
Two behaviours worth documenting while in the file, since both have cost real debugging time: the pattern is a Java regex (not Ruby — accepting a Regexp object would invite dialect bugs, so the string-only API is worth keeping and stating), and Solr matches it against the entire facet term, so an unanchored search needs explicit .*.
🤖 Generated with Claude Code
https://claude.ai/code/session_0162sTEdS4eZUe2oi2JioByV
FieldFacet#to_paramsemits the:matchesoption as a globalfacet.matchesparam:Solr scopes an unqualified facet param to every
facet.fieldin the request, so when one request facets several fields with different patterns, one pattern wins and applies to all of them. Demonstrated against Solr 8.11.4 with two facet fields and one pattern meant for the first: the second field returned no rows under the global param, and the correct rows once each field carried its ownf.<field>.facet.matches.Sunspot already solves this for
facet.prefixthroughqualified_param;:matchesshould be emitted the same way, with a spec asserting that two facets in one request keep distinct patterns.Downstream today this is latent — Glint builds every facet's pattern from the same typed prefix, so the patterns coincide — but it bites the first time two facets in a request legitimately differ.
Two behaviours worth documenting while in the file, since both have cost real debugging time: the pattern is a Java regex (not Ruby — accepting a
Regexpobject would invite dialect bugs, so the string-only API is worth keeping and stating), and Solr matches it against the entire facet term, so an unanchored search needs explicit.*.🤖 Generated with Claude Code
https://claude.ai/code/session_0162sTEdS4eZUe2oi2JioByV