lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1345378 - in /lucene/dev/branches/branch_4x: ./ dev-tools/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/std31/ lucene/analysis/common/src/java/org/apache/lucene/analys...
Date Fri, 01 Jun 2012 22:24:16 GMT
Author: hossman
Date: Fri Jun  1 22:24:14 2012
New Revision: 1345378

URL: http://svn.apache.org/viewvc?rev=1345378&view=rev
Log:
SOLR-2796: uniqueKey field can no longer be populated via <copyField/> or <field
default=...>.  Also corrected CHANGES.txt entry for related SOLR-3495 (merge r1345376 from
trunk)

Added:
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/conf/bad-schema-uniquekey-is-copyfield-dest.xml
      - copied unchanged from r1345376, lucene/dev/trunk/solr/core/src/test-files/solr/conf/bad-schema-uniquekey-is-copyfield-dest.xml
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/conf/bad-schema-uniquekey-uses-default.xml
      - copied unchanged from r1345376, lucene/dev/trunk/solr/core/src/test-files/solr/conf/bad-schema-uniquekey-uses-default.xml
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/BUILD.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/MIGRATE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/README.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/common/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/std31/package.html
  (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/std34/package.html
  (props changed)
    lucene/dev/branches/branch_4x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_4x/lucene/benchmark/   (props changed)
    lucene/dev/branches/branch_4x/lucene/build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/demo/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
    lucene/dev/branches/branch_4x/lucene/grouping/   (props changed)
    lucene/dev/branches/branch_4x/lucene/highlighter/   (props changed)
    lucene/dev/branches/branch_4x/lucene/ivy-settings.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/join/   (props changed)
    lucene/dev/branches/branch_4x/lucene/memory/   (props changed)
    lucene/dev/branches/branch_4x/lucene/misc/   (props changed)
    lucene/dev/branches/branch_4x/lucene/module-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/queries/   (props changed)
    lucene/dev/branches/branch_4x/lucene/queryparser/   (props changed)
    lucene/dev/branches/branch_4x/lucene/sandbox/   (props changed)
    lucene/dev/branches/branch_4x/lucene/site/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
    lucene/dev/branches/branch_4x/lucene/suggest/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/lucene/tools/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/README.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/cloud-dev/   (props changed)
    lucene/dev/branches/branch_4x/solr/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/contrib/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
    lucene/dev/branches/branch_4x/solr/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/httpclient-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/httpclient-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/httpcore-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/httpcore-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/httpmime-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/lib/httpmime-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/scripts/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/solr/testlogging.properties   (props changed)
    lucene/dev/branches/branch_4x/solr/webapp/   (props changed)

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1345378&r1=1345377&r2=1345378&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Fri Jun  1 22:24:14 2012
@@ -85,6 +85,14 @@ Upgrading from Solr 3.6-dev
   paths have been fixed to be resolved against the data dir.  See the example 
   solrconfig.xml and SOLR-1258 for more details.
 
+* Due to low level changes to support SolrCloud, the uniqueKey field can no 
+  longer be populated via <copyField/> or <field default=...> in the 
+  schema.xml.  Users wishing to have Solr automaticly generate a uniqueKey 
+  value when adding documents should instead use an instance of
+  solr.UUIDUpdateProcessorFactory in their update processor chain.  See 
+  SOLR-2796 for more details.
+
+
 Detailed Change List
 ----------------------
 
@@ -316,7 +324,7 @@ New Features
   prior "FieldName^boost" syntax is still accepted.  In such cases the value on the
   "ps" parameter serves as the default slop.  (Ron Mayer via James Dyer)
 
-* SOLR-2796: New UpdateProcessors have been added to create default values for 
+* SOLR-3495: New UpdateProcessors have been added to create default values for 
   configured fields.  These works similarly to the <field default="..."/> 
   option in schema.xml, but are applied in the UpdateProcessorChain, so they 
   may be used prior to other UpdateProcessors, or to generate a uniqueKey field 
@@ -605,6 +613,9 @@ Other Changes
 * SOLR-3083: JMX beans now report Numbers as numeric values rather then String
   (Tagged Siteops, Greg Bowyer via ryan)
 
+* SOLR-2796: Due to low level changes to support SolrCloud, the uniqueKey 
+  field can no longer be populated via <copyField/> or <field default=...>
+  in the schema.xml.
 
 Documentation
 ----------------------

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/IndexSchema.java?rev=1345378&r1=1345377&r2=1345378&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
Fri Jun  1 22:24:14 2012
@@ -1,4 +1,4 @@
-/**
+/*
  * 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.
@@ -465,6 +465,14 @@ public final class IndexSchema {
       log.warn("no uniqueKey specified in schema.");
     } else {
       uniqueKeyField=getIndexedField(node.getNodeValue().trim());
+      if (null != uniqueKeyField.getDefaultValue()) {
+        String msg = "uniqueKey field ("+uniqueKeyFieldName+
+          ") can not be configured with a default value ("+
+          uniqueKeyField.getDefaultValue()+")";
+        log.error(msg);
+        throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
+      }
+
       if (!uniqueKeyField.stored()) {
         log.error("uniqueKey is not stored - distributed search will not work");
       }
@@ -507,6 +515,14 @@ public final class IndexSchema {
           }
         }
 
+        if (dest.equals(uniqueKeyFieldName)) {
+          String msg = "uniqueKey field ("+uniqueKeyFieldName+
+            ") can not be the dest of a copyField (src="+source+")";
+          log.error(msg);
+          throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, msg);
+          
+        }
+
         registerCopyField(source, dest, maxCharsInt);
      }
       
@@ -517,6 +533,8 @@ public final class IndexSchema {
                       entry.getValue()+")");
         }
       }
+
+
       //Run the callbacks on SchemaAware now that everything else is done
       for (SchemaAware aware : schemaAware) {
         aware.inform(this);

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java?rev=1345378&r1=1345377&r2=1345378&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
Fri Jun  1 22:24:14 2012
@@ -1,4 +1,4 @@
-/**
+/*
  * 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.
@@ -38,7 +38,8 @@ public class BadIndexSchemaTest extends 
       // short circuit out if we found what we expected
       if (-1 != e.getMessage().indexOf(errString)) return;
       // Test the cause too in case the expected error is wrapped
-      if (-1 != e.getCause().getMessage().indexOf(errString)) return;
+      if (null != e.getCause() && 
+          -1 != e.getCause().getMessage().indexOf(errString)) return;
 
       // otherwise, rethrow it, possibly completley unrelated
       throw new SolrException
@@ -50,7 +51,6 @@ public class BadIndexSchemaTest extends 
     fail("Did not encounter any exception from: " + schema);
   }
 
-  @Test
   public void testSevereErrorsForInvalidFieldOptions() throws Exception {
     doTest("bad-schema-not-indexed-but-norms.xml", "bad_field");
     doTest("bad-schema-not-indexed-but-tf.xml", "bad_field");
@@ -58,29 +58,32 @@ public class BadIndexSchemaTest extends 
     doTest("bad-schema-omit-tf-but-not-pos.xml", "bad_field");
   }
 
-  @Test
   public void testSevereErrorsForDuplicateFields() throws Exception {
     doTest("bad-schema-dup-field.xml", "fAgain");
   }
 
-  @Test
   public void testSevereErrorsForDuplicateDynamicField() throws Exception {
     doTest("bad-schema-dup-dynamicField.xml", "_twice");
   }
 
-  @Test
   public void testSevereErrorsForDuplicateFieldType() throws Exception {
     doTest("bad-schema-dup-fieldType.xml", "ftAgain");
   }
 
-  @Test
   public void testSevereErrorsForUnexpectedAnalyzer() throws Exception {
     doTest("bad-schema-nontext-analyzer.xml", "StrField (bad_type)");
   }
 
-  @Test
   public void testBadExternalFileField() throws Exception {
     doTest("bad-schema-external-filefield.xml",
-        "Only float and pfloat");
+           "Only float and pfloat");
   }
+
+  public void testUniqueKeyRules() throws Exception {
+    doTest("bad-schema-uniquekey-is-copyfield-dest.xml", 
+           "can not be the dest of a copyField");
+    doTest("bad-schema-uniquekey-uses-default.xml", 
+           "can not be configured with a default value");
+  }
+
 }



Mime
View raw message