Skip to content

Commit

Permalink
Set fulltext as false if there is no element for fulltext index
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed May 30, 2024
1 parent 27030e7 commit 58f0220
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Classes/Common/Solr/SolrSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,14 +669,15 @@ protected function searchSolr($parameters = [], $enableCache = true)
$grouping->setLimit(100); // Results in group (TODO: check)
$grouping->setNumberOfGroups(true);

if ($parameters['fulltext'] === true) {
$fulltextExists = $parameters['fulltext'] ?? false;
if ($fulltextExists === true) {
// get highlighting component and apply settings
$selectQuery->getHighlighting();
}

$solrRequest = $solr->service->createRequest($selectQuery);

if ($parameters['fulltext'] === true) {
if ($fulltextExists === true) {
// If it is a fulltext search, enable highlighting.
// field for which highlighting is going to be performed,
// is required if you want to have OCR highlighting
Expand All @@ -703,7 +704,7 @@ protected function searchSolr($parameters = [], $enableCache = true)
$resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups();
$resultSet['numFound'] = $uidGroup->getMatches();
$highlighting = [];
if ($parameters['fulltext'] === true) {
if ($fulltextExists === true) {
$data = $result->getData();
$highlighting = $data['ocrHighlighting'];
}
Expand Down

0 comments on commit 58f0220

Please sign in to comment.