diff --git a/src/module-elasticsuite-catalog/etc/elasticsuite_indices.xml b/src/module-elasticsuite-catalog/etc/elasticsuite_indices.xml index 11f8afadb..99876e4be 100644 --- a/src/module-elasticsuite-catalog/etc/elasticsuite_indices.xml +++ b/src/module-elasticsuite-catalog/etc/elasticsuite_indices.xml @@ -39,6 +39,7 @@ 1 + 1 1 whitespace diff --git a/src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php b/src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php index c2f84d494..7926ba576 100644 --- a/src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php +++ b/src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php @@ -130,15 +130,17 @@ private function getWeightedSearchQuery(ContainerConfigurationInterface $contain $phraseMatchBoost = $relevanceConfig->getPhraseMatchBoost(); $defaultSearchField = MappingInterface::DEFAULT_SEARCH_FIELD; $searchableFieldFilter = $this->fieldFilters['searchableFieldFilter']; + $sortableAnalyzer = FieldInterface::ANALYZER_SORTABLE; + $phraseAnalyzer = FieldInterface::ANALYZER_WHITESPACE; - $phraseAnalyzer = FieldInterface::ANALYZER_WHITESPACE; if (is_string($queryText) && str_word_count($queryText) > 1) { $phraseAnalyzer = FieldInterface::ANALYZER_SHINGLE; } $searchFields = array_merge( $this->getWeightedFields($containerConfig, null, $searchableFieldFilter, $defaultSearchField), - $this->getWeightedFields($containerConfig, $phraseAnalyzer, $searchableFieldFilter, $defaultSearchField, $phraseMatchBoost) + $this->getWeightedFields($containerConfig, $phraseAnalyzer, $searchableFieldFilter, $defaultSearchField, $phraseMatchBoost), + $this->getWeightedFields($containerConfig, $sortableAnalyzer, $searchableFieldFilter, null, 2 * $phraseMatchBoost) ); $queryParams = [