From 34fc3ceb1b93b8a73244b0a3f123daa565ef035b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20FOUCRET?= Date: Wed, 4 Jan 2017 11:58:13 +0100 Subject: [PATCH] Fix mapping of sortable only fields. --- src/module-elasticsuite-core/Index/Mapping/Field.php | 4 ++-- .../Search/Request/Query/Fulltext/QueryBuilder.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/module-elasticsuite-core/Index/Mapping/Field.php b/src/module-elasticsuite-core/Index/Mapping/Field.php index d25fe3c95..edc4b6a00 100644 --- a/src/module-elasticsuite-core/Index/Mapping/Field.php +++ b/src/module-elasticsuite-core/Index/Mapping/Field.php @@ -287,11 +287,11 @@ private function getFieldAnalyzers() { $analyzers = []; - if ($this->isSearchable()) { + if ($this->isSearchable() || $this->isUsedForSortBy()) { // Default search analyzer. $analyzers = [self::ANALYZER_STANDARD]; - if ($this->getSearchWeight() > 1) { + if ($this->isSearchable() && $this->getSearchWeight() > 1) { $analyzers[] = self::ANALYZER_WHITESPACE; $analyzers[] = self::ANALYZER_SHINGLE; } 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 81312d387..27bbfe01d 100644 --- a/src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php +++ b/src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php @@ -24,6 +24,8 @@ /** * Prepare a fulltext search query. * + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) + * * @category Smile * @package Smile\ElasticsuiteCore * @author Aurelien FOUCRET