From c39a27a328f3529df0ee5c1f6f1acaf410e9af82 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Mon, 25 Jun 2012 22:05:34 +0200 Subject: [PATCH] "index_analyzer" and "search_analyzer" should override "analyzer", closes #2052. --- .../index/mapper/core/TypeParsers.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java b/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java index 0c77e836468..7119e4ff630 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java @@ -68,6 +68,13 @@ public class TypeParsers { builder.omitNorms(nodeBooleanValue(propNode)); } else if (propName.equals("omit_term_freq_and_positions")) { builder.omitTermFreqAndPositions(nodeBooleanValue(propNode)); + } else if (propName.equals("analyzer")) { + NamedAnalyzer analyzer = parserContext.analysisService().analyzer(propNode.toString()); + if (analyzer == null) { + throw new MapperParsingException("Analyzer [" + propNode.toString() + "] not found for field [" + name + "]"); + } + builder.indexAnalyzer(analyzer); + builder.searchAnalyzer(analyzer); } else if (propName.equals("index_analyzer")) { NamedAnalyzer analyzer = parserContext.analysisService().analyzer(propNode.toString()); if (analyzer == null) { @@ -80,13 +87,6 @@ public class TypeParsers { throw new MapperParsingException("Analyzer [" + propNode.toString() + "] not found for field [" + name + "]"); } builder.searchAnalyzer(analyzer); - } else if (propName.equals("analyzer")) { - NamedAnalyzer analyzer = parserContext.analysisService().analyzer(propNode.toString()); - if (analyzer == null) { - throw new MapperParsingException("Analyzer [" + propNode.toString() + "] not found for field [" + name + "]"); - } - builder.indexAnalyzer(analyzer); - builder.searchAnalyzer(analyzer); } else if (propName.equals("include_in_all")) { builder.includeInAll(nodeBooleanValue(propNode)); }