You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/03/27 17:55:17 UTC

svn commit: r1582397 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/schema/PreAnalyzedField.java core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java

Author: mikemccand
Date: Thu Mar 27 16:55:16 2014
New Revision: 1582397

URL: http://svn.apache.org/r1582397
Log:
SOLR-5915: get parserImpl=XXX working for PreAnalyzedField

Added:
    lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml   (with props)
Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1582397&r1=1582396&r2=1582397&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Thu Mar 27 16:55:16 2014
@@ -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

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java?rev=1582397&r1=1582396&r2=1582397&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java Thu Mar 27 16:55:16 2014
@@ -78,6 +78,7 @@ public class PreAnalyzedField extends Fi
           parser = new JsonPreAnalyzedParser();
         }
       }
+      args.remove(PARSER_IMPL);
     }
   }
 

Added: lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml?rev=1582397&view=auto
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml (added)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-preanalyzed.xml Thu Mar 27 16:55:16 2014
@@ -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>

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java?rev=1582397&r1=1582396&r2=1582397&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/PreAnalyzedFieldTest.java Thu Mar 27 16:55:16 2014
@@ -72,7 +72,7 @@ public class PreAnalyzedFieldTest extend
   
   @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 extend
       }
     }
   }
+
+  @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() {