add assert to make sure we fix NamedAnalyzer when upgrading to Lucene 4.5

This commit is contained in:
Shay Banon 2013-09-25 13:38:45 +02:00
parent a958d2e4fd
commit 57d6944f0f
1 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,8 @@ package org.elasticsearch.index.analysis;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CustomAnalyzerWrapper;
import org.apache.lucene.util.Version;
import org.elasticsearch.common.lucene.Lucene;
/**
* Named analyzer is an analyzer wrapper around an actual analyzer ({@link #analyzer} that is associated
@ -45,6 +47,12 @@ public class NamedAnalyzer extends CustomAnalyzerWrapper {
this(name, scope, analyzer, Integer.MIN_VALUE);
}
static {
// LUCENE MONITOR: this should be in Lucene 4.5.
assert Lucene.VERSION == Version.LUCENE_44 : "when upgrading to 4.5, we should use call analyzer#getReuseStrategy(), see https://issues.apache.org/jira/browse/LUCENE-5170";
}
public NamedAnalyzer(String name, AnalyzerScope scope, Analyzer analyzer, int positionOffsetGap) {
// our named analyzer always wrap a non per field analyzer, so no need to have per field analyzer
super(new GlobalReuseStrategy());