Add type filter and facet counts to the search endpoint

The search JSON gains tab support: the new `filter` GET parameter
restricts results to one document type (product, news, download, story,
page, market); the response carries `filter` (active value or null) and
`facets.type` with per-type counts and active flags. Counts stay
complete while a filter is active (keepAllFacetsOnSelection), so tabs
never collapse - except on an empty filtered result, documented in spec
v1.12 clause 7.16.

The parameter is named `filter` because `type` is TYPO3's reserved
page-type parameter and crashes page resolution; like q and page it is
excluded from cHash validation. Facets come from EXT:solr's native
faceting, serialized generically by SearchJsonRenderer - a future
category facet only needs TypoScript.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 15:51:26 +02:00
parent cf7a04ea15
commit 083f0937e2
5 changed files with 162 additions and 10 deletions

View File

@@ -533,3 +533,19 @@ plugin.tx_solr.index.queue {
}
}
}
# Type facet for the search JSON: counts per document type, serialized by
# SearchJsonRenderer as content.search.facets.type. keepAll* keeps the full
# counts visible while one type is selected - otherwise the tabs would
# collapse to the active one.
plugin.tx_solr.search.faceting = 1
plugin.tx_solr.search.faceting {
keepAllFacetsOnSelection = 1
facets {
type {
label = Type
field = type
keepAllOptionsOnSelection = 1
}
}
}