SOLR-5915: get parserImpl=XXX working for PreAnalyzedField

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1582397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-03-27 16:55:16 +00:00
parent b7b0643115
commit 9d52ea9598
4 changed files with 45 additions and 1 deletions

View File

@ -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_QUERY

View File

@ -78,6 +78,7 @@ public class PreAnalyzedField extends FieldType {
parser = new JsonPreAnalyzedParser();
}
}
args.remove(PARSER_IMPL);
}
}

View File

@ -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>

View File

@ -72,7 +72,7 @@ public class PreAnalyzedFieldTest extends SolrTestCaseJ4 {
@BeforeClass
public 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}]}"));
}
@Test
public void testInvalidSimple() {