lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r911232 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/update/DocumentBuilder.java
Date Thu, 18 Feb 2010 00:02:49 GMT
Author: hossman
Date: Thu Feb 18 00:02:49 2010
New Revision: 911232

URL: http://svn.apache.org/viewvc?rev=911232&view=rev
Log:
SOLR-1695: Added an earlier check for multiple values being used in the uniqueKey field -
prior to this the only check was done in the UpdateHandler (IndexSchema logs an erro if the
field is declared multiValued=true, but it's not considered fatal since it will still work
as long as clients only send one value)

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=911232&r1=911231&r2=911232&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Thu Feb 18 00:02:49 2010
@@ -242,8 +242,8 @@
 * SOLR-1771: Improved error message when StringIndex cannot be initialized
   for a function query (hossman)
 
-* SOLR-1695: Improved error message when adding a document that does not
-  contain a value for the uniqueKey field (hossman)
+* SOLR-1695: Improved error messages when adding a document that does not
+  contain exactly one value for the uniqueKey field (hossman)
 
 Build
 ----------------------

Modified: lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java?rev=911232&r1=911231&r2=911232&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java Thu Feb 18 00:02:49
2010
@@ -232,9 +232,15 @@
       Collection<Object> keys = doc.getFieldValues(uniqueKeyField.getName());
       if (null == keys || keys.isEmpty()) {
         throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
-                                "Document missing value for uniqueKeyField: " +
+                                "Document missing a value for uniqueKey field: " +
                                 uniqueKeyField.getName());
       }
+      if (1 < keys.size()) {
+        throw new SolrException
+          (SolrException.ErrorCode.BAD_REQUEST,
+           "Document contains multiple values for uniqueKey field: " +
+           uniqueKeyField.getName());
+      }
     }
     
     // Load fields from SolrDocument to Document



Mime
View raw message