Search cards above the results, detail-page fallback for market/solution documents
- New record type tx_vitec_domain_model_searchcard ("best bets"):
keyword list, priority, optional referenced record (page, product,
story, solution, market, news) and overridable title/teaser/image/link;
hidden/start/end time allow timed campaigns
- SearchCardService delivers content.search.cards on page 1: max. 3,
priority-ordered, deduplicated by URL, independent of filter, facets
and result count. Keywords match as whole words/phrases, case- and
punctuation-insensitive, including one level of the Solr managed
synonyms in both directions (cached for an hour, fail-soft). Record
cards read the record's indexed Solr document, so a card always
matches the record's own search result
- Index fallback for markets and solutions: when the record carries no
image or text, the document takes the intro image (then the hero
background) and the hero subline, intro headline and intro text from
the content blocks of its detail page - selected by CType, so it works
for layout 21 and layout 5 alike; improves results and cards
- Fix: a search request without q returned an empty body instead of the
documented empty shape (stdClass resolved inside the renderer namespace)
- migrations/check_solution_fields.php: shows live/workspace versions of
solution records
- Spec v1.22 (clause 7.16: cards)
This commit is contained in:
1 parent
8ead213bdf
commit
91ad5e6596
11 files changed
+626
-7
No files matched your search
@@ -31,6 +31,8 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
* "filter": the active type filter or null,
|
||||
* "facets": { "type": [ { "value", "count", "active" } ] } -
|
||||
* counts stay complete while a filter is active,
|
||||
* "cards": editorial cards for the query (page 1 only, max 3,
|
||||
* SearchCardService) - [] when none match,
|
||||
* "suggestions": spellcheck alternatives ("did you mean"), [] if none
|
||||
* }
|
||||
*
|
||||
@@ -271,6 +273,19 @@ class SearchJsonRenderer
|
||||
// faceting disabled or unavailable - facets stay empty
|
||||
}
|
||||
|
||||
// Editorial cards above the results - page 1 only (load-more pages
|
||||
// append results, the cards are already on screen). Independent of
|
||||
// the result count and the active filter; fail-soft on its own.
|
||||
$cards = [];
|
||||
if ($page === 1) {
|
||||
try {
|
||||
$cards = GeneralUtility::makeInstance(\Evomedien\Vitec\Service\SearchCardService::class)
|
||||
->cardsFor($query, $connection, $request, self::TYPE_LABELS);
|
||||
} catch (\Throwable) {
|
||||
$cards = [];
|
||||
}
|
||||
}
|
||||
|
||||
$numFound = $resultSet->getAllResultCount();
|
||||
$resultsPerPage = $resultSet->getUsedResultsPerPage() ?: count($results);
|
||||
|
||||
@@ -283,6 +298,7 @@ class SearchJsonRenderer
|
||||
'filter' => $activeType !== '' ? $activeType : null,
|
||||
'activeFacets' => (object)$facetFilters,
|
||||
'facets' => (object)$facets,
|
||||
'cards' => $cards,
|
||||
'results' => $results,
|
||||
'suggestions' => array_values(array_unique($suggestions)),
|
||||
]);
|
||||
@@ -303,8 +319,9 @@ class SearchJsonRenderer
|
||||
'numFound' => 0,
|
||||
'totalPages' => 0,
|
||||
'filter' => null,
|
||||
'activeFacets' => new stdClass(),
|
||||
'activeFacets' => new \stdClass(),
|
||||
'facets' => new \stdClass(),
|
||||
'cards' => [],
|
||||
'results' => [],
|
||||
'suggestions' => [],
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user