From 72182e1496d0b2416b71f2baecd5cd0051d5607a Mon Sep 17 00:00:00 2001 From: Elze Kool Date: Mon, 23 Jan 2017 16:11:00 +0100 Subject: [PATCH] Fix analyzer filter ordering The orders of the filters is important when defining an analyzer. Due to the fact that array_values is defined the sort order was lost. --- .../Model/Resource/Engine/Elasticsearch/Index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php b/src/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php index 50b58629..193afe01 100644 --- a/src/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php +++ b/src/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php @@ -217,7 +217,9 @@ protected function _getSettings() foreach ($indexSettings['analysis']['analyzer'] as &$analyzer) { $analyzer['filter'] = isset($analyzer['filter']) ? explode(',', $analyzer['filter']) : array(); - $analyzer['filter'] = array_values(array_intersect($availableFilters, $analyzer['filter'])); + $analyzer['filter'] = array_filter($analyzer['filter'], function($filter) use ($availableFilters) { + return in_array($filter, $availableFilters); + }); $analyzer['char_filter'] = isset($analyzer['char_filter']) ? explode(',', $analyzer['char_filter']) : array(); }