From ad37014a3ac6dcd53de14680ddb63b99c25b1f86 Mon Sep 17 00:00:00 2001
From: Ryan Ernst
Date: Fri, 2 May 2014 22:34:25 +0000
Subject: [PATCH] SOLR-6022: Rename getAnalyzer() to getIndexAnalyzer()
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1592076 13f79535-47bb-0310-9956-ffa450edef68
---
solr/CHANGES.txt | 7 ++
.../apache/solr/schema/ICUCollationField.java | 2 +-
...olrStopwordsCarrot2LexicalDataFactory.java | 2 +-
.../morphlines/solr/TokenizeTextBuilder.java | 2 +-
.../java/org/apache/solr/core/SolrConfig.java | 2 +-
.../DocumentAnalysisRequestHandler.java | 2 +-
.../handler/FieldAnalysisRequestHandler.java | 2 +-
.../solr/handler/MoreLikeThisHandler.java | 2 +-
.../handler/admin/LukeRequestHandler.java | 8 +-
.../highlight/DefaultSolrHighlighter.java | 4 +-
.../highlight/PostingsSolrHighlighter.java | 2 +-
.../solr/parser/SolrQueryParserBase.java | 2 +-
.../org/apache/solr/schema/BoolField.java | 2 +-
.../apache/solr/schema/CollationField.java | 2 +-
.../org/apache/solr/schema/FieldType.java | 88 +++++++++----------
.../solr/schema/FieldTypePluginLoader.java | 2 +-
.../org/apache/solr/schema/IndexSchema.java | 11 ++-
.../apache/solr/schema/PreAnalyzedField.java | 4 +-
.../org/apache/solr/schema/TextField.java | 14 +--
.../org/apache/solr/schema/TrieDateField.java | 2 -
.../solr/search/ExtendedDismaxQParser.java | 2 +-
.../solr/spelling/FileBasedSpellChecker.java | 2 +-
.../fst/AnalyzingInfixLookupFactory.java | 3 +-
.../suggest/fst/AnalyzingLookupFactory.java | 2 +-
.../fst/BlendedInfixLookupFactory.java | 2 +-
.../suggest/fst/FreeTextLookupFactory.java | 2 +-
.../suggest/fst/FuzzyLookupFactory.java | 2 +-
.../solr/update/DirectUpdateHandler2.java | 10 +--
.../solr/analysis/TestLuceneMatchVersion.java | 8 +-
.../TestReversedWildcardFilterFactory.java | 4 +-
.../org/apache/solr/schema/MultiTermTest.java | 2 +-
.../apache/solr/search/CursorMarkTest.java | 4 +-
32 files changed, 96 insertions(+), 109 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2214a0de728..e8ecdcb9737 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -48,6 +48,9 @@ Upgrading from Solr 4.x
corresponding Trie-based field type and then re-index. See SOLR-5936 for more
information.
+* getAnalyzer() in IndexSchema and FieldType that was deprecated in Solr 4.9 has
+ been removed. Use getIndexAnalyzer() instead. See SOLR-6022 for more information.
+
Detailed Change List
----------------------
@@ -149,6 +152,10 @@ Other Changes
* SOLR-6013: Fix method visibility of Evaluator, refactor DateFormatEvaluator for
extensibility. (Aaron LaBella via shalin)
+* SOLR-6022: Deprecate getAnalyzer() in IndexField and FieldType, and add getIndexAnalyzer().
+ (Ryan Ernst)
+
+
Build
---------------------
diff --git a/solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java b/solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
index b798bc96496..a04e9791582 100644
--- a/solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
+++ b/solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java
@@ -226,7 +226,7 @@ public class ICUCollationField extends FieldType {
}
@Override
- public Analyzer getAnalyzer() {
+ public Analyzer getIndexAnalyzer() {
return analyzer;
}
diff --git a/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/SolrStopwordsCarrot2LexicalDataFactory.java b/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/SolrStopwordsCarrot2LexicalDataFactory.java
index 3631c5774de..e45a116ec8c 100644
--- a/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/SolrStopwordsCarrot2LexicalDataFactory.java
+++ b/solr/contrib/clustering/src/java/org/apache/solr/handler/clustering/carrot2/SolrStopwordsCarrot2LexicalDataFactory.java
@@ -88,7 +88,7 @@ public class SolrStopwordsCarrot2LexicalDataFactory implements ILexicalDataFacto
// of this class are not used by multiple threads at a time.
if (!solrStopWords.containsKey(fieldName)) {
final Analyzer fieldAnalyzer = core.getLatestSchema().getFieldType(fieldName)
- .getAnalyzer();
+ .getIndexAnalyzer();
if (fieldAnalyzer instanceof TokenizerChain) {
final TokenFilterFactory[] filterFactories = ((TokenizerChain) fieldAnalyzer)
.getTokenFilterFactories();
diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java
index e4490b70f3e..165fc27c3ea 100644
--- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java
+++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java
@@ -79,7 +79,7 @@ public final class TokenizeTextBuilder implements CommandBuilder {
if (fieldType == null) {
throw new MorphlineCompilationException("Missing Solr field type in schema.xml for name: " + solrFieldType, config);
}
- this.analyzer = fieldType.getAnalyzer();
+ this.analyzer = fieldType.getIndexAnalyzer();
Preconditions.checkNotNull(analyzer);
try { // register CharTermAttribute for later (implicit) reuse
this.token = analyzer.tokenStream("content", reader).addAttribute(CharTermAttribute.class);
diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
index 2db059afdc5..fd69b0108b5 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
@@ -264,7 +264,7 @@ public class SolrConfig extends Config {
// TODO: WTF is up with queryConverter???
// it aparently *only* works as a singleton? - SOLR-4304
// and even then -- only if there is a single SpellCheckComponent
- // because of queryConverter.setAnalyzer
+ // because of queryConverter.setIndexAnalyzer
loadPluginInfo(QueryConverter.class,"queryConverter",
REQUIRE_NAME, REQUIRE_CLASS);
diff --git a/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
index a75857e65c2..b84ce702e62 100644
--- a/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
@@ -237,7 +237,7 @@ public class DocumentAnalysisRequestHandler extends AnalysisRequestHandlerBase {
}
}
- Analyzer analyzer = fieldType.getAnalyzer();
+ Analyzer analyzer = fieldType.getIndexAnalyzer();
AnalysisContext analysisContext = new AnalysisContext(fieldType, analyzer, termsToMatch);
Collection
* @see #getQueryAnalyzer
*/
- public Analyzer getAnalyzer() {
- return analyzer;
+ public Analyzer getIndexAnalyzer() {
+ return indexAnalyzer;
}
/**
@@ -515,51 +500,64 @@ public abstract class FieldType extends FieldProperties {
*
* This method may be called many times, at any time.
*
- * @see #getAnalyzer
+ * @see #getIndexAnalyzer
*/
public Analyzer getQueryAnalyzer() {
return queryAnalyzer;
}
+ /**
+ * Returns true if this type supports index and query analyzers, false otherwise.
+ */
+ protected boolean supportsAnalyzers() {
+ return false;
+ }
+
/**
* Sets the Analyzer to be used when indexing fields of this type.
*
*
- * The default implementation throws a SolrException.
- * Subclasses that override this method need to ensure the behavior
- * of the analyzer is consistent with the implementation of toInternal.
+ * Subclasses should override {@link #supportsAnalyzers()} to
+ * enable this function.
*
- *
- * @see #toInternal
+ *
+ * @see #supportsAnalyzers()
* @see #setQueryAnalyzer
- * @see #getAnalyzer
+ * @see #getIndexAnalyzer
*/
- public void setAnalyzer(Analyzer analyzer) {
- throw new SolrException
- (ErrorCode.SERVER_ERROR,
- "FieldType: " + this.getClass().getSimpleName() +
- " (" + typeName + ") does not support specifying an analyzer");
+ public final void setIndexAnalyzer(Analyzer analyzer) {
+ if (supportsAnalyzers()) {
+ indexAnalyzer = analyzer;
+ } else {
+ throw new SolrException
+ (ErrorCode.SERVER_ERROR,
+ "FieldType: " + this.getClass().getSimpleName() +
+ " (" + typeName + ") does not support specifying an analyzer");
+ }
}
/**
* Sets the Analyzer to be used when querying fields of this type.
*
*
- * The default implementation throws a SolrException.
- * Subclasses that override this method need to ensure the behavior
- * of the analyzer is consistent with the implementation of toInternal.
+ * Subclasses should override {@link #supportsAnalyzers()} to
+ * enable this function.
*
- *
- * @see #toInternal
- * @see #setAnalyzer
+ *
+ * @see #supportsAnalyzers()
+ * @see #setIndexAnalyzer
* @see #getQueryAnalyzer
*/
- public void setQueryAnalyzer(Analyzer analyzer) {
- throw new SolrException
- (ErrorCode.SERVER_ERROR,
- "FieldType: " + this.getClass().getSimpleName() +
- " (" + typeName + ") does not support specifying an analyzer");
+ public final void setQueryAnalyzer(Analyzer analyzer) {
+ if (supportsAnalyzers()) {
+ queryAnalyzer = analyzer;
+ } else {
+ throw new SolrException
+ (ErrorCode.SERVER_ERROR,
+ "FieldType: " + this.getClass().getSimpleName() +
+ " (" + typeName + ") does not support specifying an analyzer");
+ }
}
/** @lucene.internal */
@@ -845,7 +843,7 @@ public abstract class FieldType extends FieldProperties {
if (isExplicitAnalyzer()) {
String analyzerProperty = isExplicitQueryAnalyzer() ? INDEX_ANALYZER : ANALYZER;
- namedPropertyValues.add(analyzerProperty, getAnalyzerProperties(getAnalyzer()));
+ namedPropertyValues.add(analyzerProperty, getAnalyzerProperties(getIndexAnalyzer()));
}
if (isExplicitQueryAnalyzer()) {
String analyzerProperty = isExplicitAnalyzer() ? QUERY_ANALYZER : ANALYZER;
diff --git a/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java b/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java
index 7572972a0b5..075d5a9ee02 100644
--- a/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java
+++ b/solr/core/src/java/org/apache/solr/schema/FieldTypePluginLoader.java
@@ -116,7 +116,7 @@ public final class FieldTypePluginLoader
}
if (null != analyzer) {
- ft.setAnalyzer(analyzer);
+ ft.setIndexAnalyzer(analyzer);
ft.setQueryAnalyzer(queryAnalyzer);
if (ft instanceof TextField) {
if (null == multiAnalyzer) {
diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
index 2f495802114..d7f3124802e 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -51,7 +51,6 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
-import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
@@ -128,7 +127,7 @@ public class IndexSchema {
protected volatile DynamicField[] dynamicFields;
public DynamicField[] getDynamicFields() { return dynamicFields; }
- private Analyzer analyzer;
+ private Analyzer indexAnalyzer;
private Analyzer queryAnalyzer;
protected List schemaAware = new ArrayList<>();
@@ -276,7 +275,7 @@ public class IndexSchema {
* a field specific Analyzer based on the field type.
*
*/
- public Analyzer getAnalyzer() { return analyzer; }
+ public Analyzer getIndexAnalyzer() { return indexAnalyzer; }
/**
* Returns the Analyzer used when searching this index
@@ -355,7 +354,7 @@ public class IndexSchema {
* @since solr 1.3
*/
public void refreshAnalyzers() {
- analyzer = new SolrIndexAnalyzer();
+ indexAnalyzer = new SolrIndexAnalyzer();
queryAnalyzer = new SolrQueryAnalyzer();
}
@@ -388,7 +387,7 @@ public class IndexSchema {
protected HashMap analyzerCache() {
HashMap cache = new HashMap<>();
for (SchemaField f : getFields().values()) {
- Analyzer analyzer = f.getType().getAnalyzer();
+ Analyzer analyzer = f.getType().getIndexAnalyzer();
cache.put(f.getName(), analyzer);
}
return cache;
@@ -397,7 +396,7 @@ public class IndexSchema {
@Override
protected Analyzer getWrappedAnalyzer(String fieldName) {
Analyzer analyzer = analyzers.get(fieldName);
- return analyzer != null ? analyzer : getDynamicFieldType(fieldName).getAnalyzer();
+ return analyzer != null ? analyzer : getDynamicFieldType(fieldName).getIndexAnalyzer();
}
}
diff --git a/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java b/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java
index 966e0954749..6d85e9a31ee 100644
--- a/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java
+++ b/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java
@@ -83,7 +83,7 @@ public class PreAnalyzedField extends FieldType {
}
@Override
- public Analyzer getAnalyzer() {
+ public Analyzer getIndexAnalyzer() {
return new SolrAnalyzer() {
@Override
@@ -96,7 +96,7 @@ public class PreAnalyzedField extends FieldType {
@Override
public Analyzer getQueryAnalyzer() {
- return getAnalyzer();
+ return getIndexAnalyzer();
}
@Override
diff --git a/solr/core/src/java/org/apache/solr/schema/TextField.java b/solr/core/src/java/org/apache/solr/schema/TextField.java
index 68c740dbc57..669dea6572d 100644
--- a/solr/core/src/java/org/apache/solr/schema/TextField.java
+++ b/solr/core/src/java/org/apache/solr/schema/TextField.java
@@ -41,7 +41,7 @@ public class TextField extends FieldType {
/**
* Analyzer set by schema for text types to use when searching fields
* of this type, subclasses can set analyzer themselves or override
- * getAnalyzer()
+ * getIndexAnalyzer()
* This analyzer is used to process wildcard, prefix, regex and other multiterm queries. It
* assembles a list of tokenizer +filters that "make sense" for this, primarily accent folding and
* lowercasing filters, and charfilters.
@@ -76,7 +76,7 @@ public class TextField extends FieldType {
*
* This method may be called many times, at any time.
*
- * @see #getAnalyzer
+ * @see #getIndexAnalyzer
*/
public Analyzer getMultiTermAnalyzer() {
return multiTermAnalyzer;
@@ -112,16 +112,10 @@ public class TextField extends FieldType {
}
@Override
- public void setAnalyzer(Analyzer analyzer) {
- this.analyzer = analyzer;
+ protected boolean supportsAnalyzers() {
+ return true;
}
- @Override
- public void setQueryAnalyzer(Analyzer analyzer) {
- this.queryAnalyzer = analyzer;
- }
-
-
@Override
public Query getRangeQuery(QParser parser, SchemaField field, String part1, String part2, boolean minInclusive, boolean maxInclusive) {
Analyzer multiAnalyzer = getMultiTermAnalyzer();
diff --git a/solr/core/src/java/org/apache/solr/schema/TrieDateField.java b/solr/core/src/java/org/apache/solr/schema/TrieDateField.java
index 79ff9f1d311..967522bc066 100644
--- a/solr/core/src/java/org/apache/solr/schema/TrieDateField.java
+++ b/solr/core/src/java/org/apache/solr/schema/TrieDateField.java
@@ -347,8 +347,6 @@ public class TrieDateField extends PrimitiveFieldType implements DateValueFieldT
@Override
protected void init(IndexSchema schema, Map args) {
wrappedField.init(schema, args);
- analyzer = wrappedField.analyzer;
- queryAnalyzer = wrappedField.queryAnalyzer;
}
@Override
diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
index 315cb7ec7e6..9d21150f070 100644
--- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
@@ -1230,7 +1230,7 @@ public class ExtendedDismaxQParser extends QParser {
}
TokenizerChain tcq = (TokenizerChain) qa;
- Analyzer ia = ft.getAnalyzer();
+ Analyzer ia = ft.getIndexAnalyzer();
if (ia == qa || !(ia instanceof TokenizerChain)) {
return qa;
}
diff --git a/solr/core/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java b/solr/core/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
index 9a62f5305e5..fb730eb600c 100644
--- a/solr/core/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
+++ b/solr/core/src/java/org/apache/solr/spelling/FileBasedSpellChecker.java
@@ -96,7 +96,7 @@ public class FileBasedSpellChecker extends AbstractLuceneSpellChecker {
IndexWriter writer = new IndexWriter(
ramDir,
- new IndexWriterConfig(core.getSolrConfig().luceneMatchVersion, fieldType.getAnalyzer()).
+ new IndexWriterConfig(core.getSolrConfig().luceneMatchVersion, fieldType.getIndexAnalyzer()).
setMaxBufferedDocs(150).
setMergePolicy(mp).
setOpenMode(IndexWriterConfig.OpenMode.CREATE)
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java
index a11d6d22361..070fb839cee 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.search.suggest.Lookup;
import org.apache.lucene.search.suggest.analyzing.AnalyzingInfixSuggester;
-import org.apache.lucene.search.suggest.analyzing.AnalyzingSuggester;
import org.apache.lucene.store.FSDirectory;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
@@ -76,7 +75,7 @@ public class AnalyzingInfixLookupFactory extends LookupFactory {
if (ft == null) {
throw new IllegalArgumentException("Error in configuration: " + fieldTypeName.toString() + " is not defined in the schema");
}
- Analyzer indexAnalyzer = ft.getAnalyzer();
+ Analyzer indexAnalyzer = ft.getIndexAnalyzer();
Analyzer queryAnalyzer = ft.getQueryAnalyzer();
// optional parameters
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingLookupFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingLookupFactory.java
index cba9d3a661b..f48ac8db916 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingLookupFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingLookupFactory.java
@@ -87,7 +87,7 @@ public class AnalyzingLookupFactory extends LookupFactory {
throw new IllegalArgumentException("Error in configuration: " + fieldTypeName.toString() + " is not defined in the schema");
}
- Analyzer indexAnalyzer = ft.getAnalyzer();
+ Analyzer indexAnalyzer = ft.getIndexAnalyzer();
Analyzer queryAnalyzer = ft.getQueryAnalyzer();
// optional parameters
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/BlendedInfixLookupFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/BlendedInfixLookupFactory.java
index 7c20b5645a5..b895ff0de72 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/BlendedInfixLookupFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/BlendedInfixLookupFactory.java
@@ -74,7 +74,7 @@ public class BlendedInfixLookupFactory extends AnalyzingInfixLookupFactory {
if (ft == null) {
throw new IllegalArgumentException("Error in configuration: " + fieldTypeName.toString() + " is not defined in the schema");
}
- Analyzer indexAnalyzer = ft.getAnalyzer();
+ Analyzer indexAnalyzer = ft.getIndexAnalyzer();
Analyzer queryAnalyzer = ft.getQueryAnalyzer();
// optional parameters
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java
index 730a2ba417d..bc44a8be8a9 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FreeTextLookupFactory.java
@@ -64,7 +64,7 @@ public class FreeTextLookupFactory extends LookupFactory {
throw new IllegalArgumentException("Error in configuration: " + fieldTypeName.toString() + " is not defined in the schema");
}
- Analyzer indexAnalyzer = ft.getAnalyzer();
+ Analyzer indexAnalyzer = ft.getIndexAnalyzer();
Analyzer queryAnalyzer = ft.getQueryAnalyzer();
int grams = (params.get(NGRAMS) != null)
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FuzzyLookupFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FuzzyLookupFactory.java
index 5dae427c729..cf6af322a07 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FuzzyLookupFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/FuzzyLookupFactory.java
@@ -81,7 +81,7 @@ public class FuzzyLookupFactory extends LookupFactory {
if (ft == null) {
throw new IllegalArgumentException("Error in configuration: " + fieldTypeName.toString() + " is not defined in the schema");
}
- Analyzer indexAnalyzer = ft.getAnalyzer();
+ Analyzer indexAnalyzer = ft.getIndexAnalyzer();
Analyzer queryAnalyzer = ft.getQueryAnalyzer();
// optional parameters
diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
index 5338e48edc6..a7ace1dd072 100644
--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
@@ -229,11 +229,11 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
}
if (cmd.isBlock()) {
- writer.updateDocuments(updateTerm, cmd, schema.getAnalyzer());
+ writer.updateDocuments(updateTerm, cmd, schema.getIndexAnalyzer());
} else {
Document luceneDocument = cmd.getLuceneDocument();
// SolrCore.verbose("updateDocument",updateTerm,luceneDocument,writer);
- writer.updateDocument(updateTerm, luceneDocument, schema.getAnalyzer());
+ writer.updateDocument(updateTerm, luceneDocument, schema.getIndexAnalyzer());
}
// SolrCore.verbose("updateDocument",updateTerm,"DONE");
@@ -258,9 +258,9 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
} else {
// allow duplicates
if (cmd.isBlock()) {
- writer.addDocuments(cmd, schema.getAnalyzer());
+ writer.addDocuments(cmd, schema.getIndexAnalyzer());
} else {
- writer.addDocument(cmd.getLuceneDocument(), schema.getAnalyzer());
+ writer.addDocument(cmd.getLuceneDocument(), schema.getIndexAnalyzer());
}
if (ulog != null) ulog.add(cmd);
@@ -437,7 +437,7 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
try {
IndexWriter writer = iw.get();
writer.updateDocument(idTerm, luceneDocument, cmd.getReq().getSchema()
- .getAnalyzer());
+ .getIndexAnalyzer());
for (Query q : dbqList) {
writer.deleteDocuments(q);
diff --git a/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java b/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
index ca38f894b2e..3ae0dc2db47 100644
--- a/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
+++ b/solr/core/src/test/org/apache/solr/analysis/TestLuceneMatchVersion.java
@@ -47,12 +47,12 @@ public class TestLuceneMatchVersion extends SolrTestCaseJ4 {
final IndexSchema schema = h.getCore().getLatestSchema();
FieldType type = schema.getFieldType("textDefault");
- TokenizerChain ana = (TokenizerChain) type.getAnalyzer();
+ TokenizerChain ana = (TokenizerChain) type.getIndexAnalyzer();
assertEquals(DEFAULT_VERSION, (ana.getTokenizerFactory()).getLuceneMatchVersion());
assertEquals(DEFAULT_VERSION, (ana.getTokenFilterFactories()[2]).getLuceneMatchVersion());
type = schema.getFieldType("text40");
- ana = (TokenizerChain) type.getAnalyzer();
+ ana = (TokenizerChain) type.getIndexAnalyzer();
assertEquals(Version.LUCENE_4_0, (ana.getTokenizerFactory()).getLuceneMatchVersion());
assertEquals(Version.LUCENE_5_0, (ana.getTokenFilterFactories()[2]).getLuceneMatchVersion());
@@ -61,12 +61,12 @@ public class TestLuceneMatchVersion extends SolrTestCaseJ4 {
matchVersionField.setAccessible(true);
type = schema.getFieldType("textStandardAnalyzerDefault");
- Analyzer ana1 = type.getAnalyzer();
+ Analyzer ana1 = type.getIndexAnalyzer();
assertTrue(ana1 instanceof StandardAnalyzer);
assertEquals(DEFAULT_VERSION, matchVersionField.get(ana1));
type = schema.getFieldType("textStandardAnalyzer40");
- ana1 = type.getAnalyzer();
+ ana1 = type.getIndexAnalyzer();
assertTrue(ana1 instanceof StandardAnalyzer);
assertEquals(Version.LUCENE_4_0, matchVersionField.get(ana1));
}
diff --git a/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java b/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java
index 181dd68cbec..f367e11fd53 100644
--- a/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java
+++ b/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java
@@ -18,14 +18,12 @@ package org.apache.solr.analysis;
import java.io.IOException;
-import java.io.StringReader;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.search.AutomatonQuery;
import org.apache.lucene.search.Query;
@@ -82,7 +80,7 @@ public class TestReversedWildcardFilterFactory extends SolrTestCaseJ4 {
@Test
public void testIndexingAnalysis() throws Exception {
- Analyzer a = schema.getAnalyzer();
+ Analyzer a = schema.getIndexAnalyzer();
String text = "one two three si\uD834\uDD1Ex";
// field one
diff --git a/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java b/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java
index dcf792b2906..ae5b59aaca9 100644
--- a/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java
@@ -51,7 +51,7 @@ public class MultiTermTest extends SolrTestCaseJ4 {
assertTrue((factory instanceof ASCIIFoldingFilterFactory) || (factory instanceof LowerCaseFilterFactory));
}
- analyzer = field.getType().getAnalyzer();
+ analyzer = field.getType().getIndexAnalyzer();
assertTrue(analyzer instanceof TokenizerChain);
assertTrue(((TokenizerChain) analyzer).getTokenizerFactory() instanceof WhitespaceTokenizerFactory);
tc = (TokenizerChain) analyzer;
diff --git a/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java b/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java
index 781814049b8..a2c89bdf669 100644
--- a/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java
+++ b/solr/core/src/test/org/apache/solr/search/CursorMarkTest.java
@@ -26,7 +26,6 @@ import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
-import org.apache.solr.schema.TrieDateField;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.CursorPagingTest;
@@ -35,7 +34,6 @@ import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_START;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
@@ -265,7 +263,7 @@ public class CursorMarkTest extends SolrTestCaseJ4 {
private static Object getRandomCollation(SchemaField sf) throws IOException {
Object val;
- Analyzer analyzer = sf.getType().getAnalyzer();
+ Analyzer analyzer = sf.getType().getIndexAnalyzer();
String term = TestUtil.randomRealisticUnicodeString(random());
try (TokenStream ts = analyzer.tokenStream("fake", term)) {
TermToBytesRefAttribute termAtt = ts.addAttribute(TermToBytesRefAttribute.class);