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.

This commit is contained in:
Shay Banon 2012-06-27 21:16:03 +02:00
parent 834c79597e
commit 644dcb99cf
1 changed files with 4 additions and 2 deletions

View File

@ -224,12 +224,14 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, 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;