You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2012/07/30 23:30:12 UTC

svn commit: r1367316 - in /lucene/dev/trunk/solr: ./ core/src/java/org/apache/solr/schema/ core/src/test-files/solr/collection1/conf/ core/src/test/org/apache/solr/schema/ example/example-DIH/solr/db/conf/ example/example-DIH/solr/rss/conf/ example/exa...

Author: hossman
Date: Mon Jul 30 21:30:12 2012
New Revision: 1367316

URL: http://svn.apache.org/viewvc?rev=1367316&view=rev
Log:
SOLR-3682: Fail to parse schema.xml if uniqueKeyField is multivalued

Added:
    lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-schema-uniquekey-multivalued.xml   (with props)
Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
    lucene/dev/trunk/solr/example/example-DIH/solr/db/conf/schema.xml
    lucene/dev/trunk/solr/example/example-DIH/solr/rss/conf/schema.xml
    lucene/dev/trunk/solr/example/example-DIH/solr/solr/conf/schema.xml
    lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Mon Jul 30 21:30:12 2012
@@ -34,6 +34,15 @@ Velocity 1.6.4 and Velocity Tools 2.0
 Apache UIMA 2.3.1
 Apache ZooKeeper 3.3.5
 
+Upgrading from Solr 4.0.0-ALPHA
+----------------------
+
+Solr is now much more strict about requiring that the uniqueKeyField feature 
+(if used) must refer to a field which is not multiValued.  If you upgrade from 
+an earlier version of Solr and see an error that your uniqueKeyField "can not 
+be configured to be multivalued" please add 'multiValued="false"' to the 
+<field /> declaration for your uniqueKeyField.  See SOLR-3682 for more details.
+
 Detailed Change List
 ----------------------
 
@@ -188,6 +197,8 @@ Other Changes
 * SOLR-3683: Improved error handling if an <analyzer> contains both an 
   explicit class attribute, as well as nested factories. (hossman)
 
+* SOLR-3682: Fail to parse schema.xml if uniqueKeyField is multivalued (hossman)
+
 ==================  4.0.0-ALPHA ==================
 More information about this release, including any errata related to the 
 release notes, upgrade instructions, or other changes may be found online at:

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/IndexSchema.java?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/IndexSchema.java Mon Jul 30 21:30:12 2012
@@ -499,7 +499,10 @@ public final class IndexSchema {
         log.error("uniqueKey is not stored - distributed search will not work");
       }
       if (uniqueKeyField.multiValued()) {
-        log.error("uniqueKey should not be multivalued");
+        String msg = "uniqueKey field ("+uniqueKeyFieldName+
+          ") can not be configured to be multivalued";
+        log.error(msg);
+        throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
       }
       uniqueKeyFieldName=uniqueKeyField.getName();
       uniqueKeyFieldType=uniqueKeyField.getType();

Added: lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-schema-uniquekey-multivalued.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-schema-uniquekey-multivalued.xml?rev=1367316&view=auto
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-schema-uniquekey-multivalued.xml (added)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-schema-uniquekey-multivalued.xml Mon Jul 30 21:30:12 2012
@@ -0,0 +1,33 @@
+<?xml version="1.0" ?>
+<!--
+ 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="bad-schema-uniquekey-multivalued" version="1.4">
+  <types>
+    <fieldType name="string" class="solr.StrField" multiValued="true"/>
+ </types>
+
+ <fields>
+   <!-- BEGIN BAD STUFF: multiValued inherited from field type -->
+   <field name="id" type="string" indexed="true" stored="true" />
+   <!-- END BAD STUFF -->
+ </fields>
+
+ <defaultSearchField>id</defaultSearchField>
+ <uniqueKey>id</uniqueKey>
+
+</schema>

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java Mon Jul 30 21:30:12 2012
@@ -62,6 +62,8 @@ public class BadIndexSchemaTest extends 
            "can not be the dest of a copyField");
     doTest("bad-schema-uniquekey-uses-default.xml", 
            "can not be configured with a default value");
+    doTest("bad-schema-uniquekey-multivalued.xml", 
+           "can not be configured to be multivalued");
   }
 
   public void testPerFieldtypeSimButNoSchemaSimFactory() throws Exception {

Modified: lucene/dev/trunk/solr/example/example-DIH/solr/db/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/example-DIH/solr/db/conf/schema.xml?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/example-DIH/solr/db/conf/schema.xml (original)
+++ lucene/dev/trunk/solr/example/example-DIH/solr/db/conf/schema.xml Mon Jul 30 21:30:12 2012
@@ -259,7 +259,7 @@
        best performance.
    -->
 
-   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
+   <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
    <field name="name" type="text" indexed="true" stored="true"/>
    <field name="nameSort" type="string" indexed="true" stored="false"/>

Modified: lucene/dev/trunk/solr/example/example-DIH/solr/rss/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/example-DIH/solr/rss/conf/schema.xml?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/example-DIH/solr/rss/conf/schema.xml (original)
+++ lucene/dev/trunk/solr/example/example-DIH/solr/rss/conf/schema.xml Mon Jul 30 21:30:12 2012
@@ -291,7 +291,7 @@
 	
 	<field name="subject" type="text" indexed="true" stored="true" />
 	<field name="title" type="text" indexed="true" stored="true" />
-	<field name="link" type="string" indexed="true" stored="true" />
+	<field name="link" type="string" indexed="true" stored="true" multiValued="false" />
 	<field name="description" type="html" indexed="true" stored="true" />
 	<field name="creator" type="string" indexed="false" stored="true" />
 	<field name="item-subject" type="string" indexed="true" stored="false" />

Modified: lucene/dev/trunk/solr/example/example-DIH/solr/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/example-DIH/solr/solr/conf/schema.xml?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/example-DIH/solr/solr/conf/schema.xml (original)
+++ lucene/dev/trunk/solr/example/example-DIH/solr/solr/conf/schema.xml Mon Jul 30 21:30:12 2012
@@ -259,7 +259,7 @@
        best performance.
    -->
 
-   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
+   <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
    <field name="name" type="text" indexed="true" stored="true"/>
    <field name="nameSort" type="string" indexed="true" stored="false"/>

Modified: lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml?rev=1367316&r1=1367315&r2=1367316&view=diff
==============================================================================
--- lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml Mon Jul 30 21:30:12 2012
@@ -91,7 +91,7 @@
       trailing underscores (e.g. _version_) are reserved.
    -->
         
-   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
+   <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/>
    <field name="name" type="text_general" indexed="true" stored="true"/>
    <field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>