If highlighting enabled, make search api query 'keys' field non-empty

The search api highlight processor checks if the 'keys' field is non-empty and then creates the excerpt. Since we are getting the highlighting result from Solr instead of creating one using the search api processor, we just need to make this field non-empty
This commit is contained in:
Amy Li 2023-03-13 11:48:10 -04:00 committed by amym-li
parent 84a1c78ad1
commit 506da48b59

View file

@ -266,12 +266,12 @@ class AdvancedSearchQuery {
$this->setHighlighting($solarium_query, $search_api_query, $highlighted_fields); $this->setHighlighting($solarium_query, $search_api_query, $highlighted_fields);
// We need to set the 'keys' field of the Search API Query to the // The Search API Highlight processor checks if the 'keys' field of
// advanced search input since the Search API Highlight processor checks // the Search API Query is non-empty before creating an excerpt.
// this field to know which keywords to highlight in the excerpt. // Since we are getting the highlighting result from Solr instead
// of using the Search API processor to create one, we just need
// logging($q); // make this field non-empty.
// $search_api_query->keys($q); $search_api_query->keys("advanced search");
} }
$solarium_query->setQuery($q); $solarium_query->setQuery($q);