Description
When searching for long keywords (i.e. terms with multiple words), Solr does not return results and we fall back to fuzzy search which can result in too many results.
Reason: in exact search mode we are checking the searchable attributes explicitly in the form of name_t:"lorem ipsum dolor"~100^5 OR sku_t_mv:"lorem ipsum dolor"~100^6 OR ...
This only works as long as the word count does not exceed gramSize
and shingleSize
, then the result is empty. If we let Solr handle the search term additionally, we get the correct results: "lorem ipsum dolor" OR name_t:"lorem ipsum dolor"~100^5 OR sku_t_mv:"lorem ipsum dolor"~100^6 OR ...
Patch:
https://github.com/integer-net/solr-base/blob/master/src/Solr/Query/SearchQueryBuilder.php#L154-L157
- $queryText = '';
$attributes = $this->getAttributeRepository()->getSearchableAttributes($this->getStoreId());
- $isFirst = true;
+ $isFirst = false;
To be tested: how does this change affect weighted attributes?