Fixed the issue of reload search results when search query is a single word

This commit is contained in:
Kyle Huynh 2022-01-25 21:48:34 +00:00
parent 678695681d
commit 81342141fc

View file

@ -162,9 +162,11 @@ class AdvancedSearchQuery {
}
$q = implode(' ', $q);
/** @var Solarium\QueryType\Select\Query\Query $solarium_query */
if ((strpos($q, "*") !== false || strpos($q, "?") !== false)) {
// enable wildcard
if ((strpos($q, "*") !== false || strpos($q, "?") !== false) || (strpos(trim($q), ' ') === false) ) {
// if the query string contain '*', '?', OR is a single world, enable wildcard
$tmp = str_replace('"', "", trim($q));
$query_fields = [];
foreach ($field_mapping as $key => $field) {