Skip to content

Commit f836d45

Browse files
authored
Merge pull request #152 from usemarkup/fix/search-boosters
fix(search): apply boost fields with search term
2 parents 97c6410 + c55f15e commit f836d45

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/Builder/SolariumSelectQueryBuilder.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,7 @@ function ($field) {
223223
$boostQueryFields = $query->getBoostQueryFields();
224224

225225
// if searching text
226-
if (!$query->getDefinedSortOrder()
227-
&& $query->hasSearchTerm()
228-
&& !$query->getSortCollection()
229-
&& !empty($query->getBoostQueryFields())
230-
) {
226+
if ($query->hasSearchTerm()) {
231227
//apply boosts
232228
$queryFields = [];
233229
$boostLucenifier = new BoostLucenifier();
@@ -241,7 +237,7 @@ function ($field) {
241237
//if there are sorts to apply, apply them
242238
$sortCollection = $query->getSortCollection();
243239

244-
if ($sortCollection instanceof SortCollectionInterface) {
240+
if ($sortCollection instanceof SortCollectionInterface && !$query->hasSearchTerm()) {
245241
foreach ($sortCollection as $sort) {
246242
try {
247243
$sortKey = $sort->getFilter()->getSearchKey();

0 commit comments

Comments
 (0)