Apache Solr open-source search software
SOLR-5915: get parserImpl=XXX working for PreAnalyzedField
Michael McCandless9d52ea9598e5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 58b9b04e3a5..9458473ced2 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -167,6 +167,9 @@ Bug Fixes* SOLR-5893: On restarting overseer designate , move itself to front of the queue (Noble Paul)+* SOLR-5915: Attempts to specify the parserImpl for+ solr.PreAnalyzedField fieldtype failed. (Mike McCandless)+Optimizations----------------------* SOLR-1880: Distributed Search skips GET_FIELDS stage if EXECUTE_QUERYdiff --git a/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java b/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.javaindex 3e495747730..966e0954749 100644--- a/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java+++ b/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java@@ -78,6 +78,7 @@ public class PreAnalyzedField extends FieldType {parser = new JsonPreAnalyzedParser();}}+ args.remove(PARSER_IMPL);}}diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml b/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xmlnew file mode 100644index 00000000000..a9422e313e6--- /dev/null+++ b/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml@@ -0,0 +1,34 @@+<?xml version="1.0" encoding="UTF-8" ?>+<!--+ Licensed to the Apache Software Foundation (ASF) under one or more+ contributor license agreements. See the NOTICE file distributed with+ this work for additional information regarding copyright ownership.+ The ASF licenses this file to You under the Apache License, Version 2.0+ (the "License"); you may not use this file except in compliance with+ the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.+-->+<schema name="tiny" version="1.1">++ <types>+ <fieldtype name="preanalyzed" class="solr.PreAnalyzedField" parserImpl="json"/>+ <fieldType name="string" class="solr.StrField"/>+ <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>+ </types>++ <fields>+ <field name="id" type="string" indexed="true" stored="true" required="true"/>+ <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>+ <field name="pre" type="preanalyzed" indexed="true" stored="true" multiValued="false"/>+ </fields>++ <uniqueKey>id</uniqueKey>++</schema>diff --git a/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java b/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.javaindex f7135f46302..f30b7ba96bb 100644--- a/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java+++ b/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java@@ -72,7 +72,7 @@ public class PreAnalyzedFieldTest extends SolrTestCaseJ4 {@BeforeClasspublic static void beforeClass() throws Exception {- initCore("solrconfig.xml","schema.xml");+ initCore("solrconfig-minimal.xml","schema-preanalyzed.xml");}@Override@@ -101,6 +101,12 @@ public class PreAnalyzedFieldTest extends SolrTestCaseJ4 {}}}++ @Test+ public void testValidSimple2() {+ assertU(adoc("id", "1",+ "pre", "{\"v\":\"1\",\"str\":\"document one\",\"tokens\":[{\"t\":\"one\"},{\"t\":\"two\"},{\"t\":\"three\",\"i\":100}]}"));+ }@Testpublic void testInvalidSimple() {