From 644dcb99cf18f9ada110716d2bfe9639d7d22221 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 27 Jun 2012 21:16:03 +0200 Subject: [PATCH] Setting index to no ends up using by default the "keyword" analyzer on it, which means one can't highlight on it when searching on _all, closes #2062. --- .../index/mapper/core/AbstractFieldMapper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java index ff2f4346981..64266f16160 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/AbstractFieldMapper.java @@ -224,12 +224,14 @@ public abstract class AbstractFieldMapper implements FieldMapper, Mapper { this.omitNorms = omitNorms; this.omitTermFreqAndPositions = omitTermFreqAndPositions; this.indexOptions = omitTermFreqAndPositions ? FieldInfo.IndexOptions.DOCS_ONLY : FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; - if (indexAnalyzer == null && !index.isAnalyzed()) { + // automatically set to keyword analyzer if its indexed and not analyzed + if (indexAnalyzer == null && !index.isAnalyzed() && index.isIndexed()) { this.indexAnalyzer = Lucene.KEYWORD_ANALYZER; } else { this.indexAnalyzer = indexAnalyzer; } - if (searchAnalyzer == null && !index.isAnalyzed()) { + // automatically set to keyword analyzer if its indexed and not analyzed + if (searchAnalyzer == null && !index.isAnalyzed() && index.isIndexed()) { this.searchAnalyzer = Lucene.KEYWORD_ANALYZER; } else { this.searchAnalyzer = searchAnalyzer;