lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1379940 [13/13] - in /lucene/dev/branches/lucene3312: ./ dev-tools/ dev-tools/maven/solr/core/ dev-tools/maven/solr/solrj/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/util/ lu...
Date Sun, 02 Sep 2012 11:21:05 GMT
Modified: lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java?rev=1379940&r1=1379939&r2=1379940&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
(original)
+++ lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java
Sun Sep  2 11:21:01 2012
@@ -19,7 +19,6 @@ package org.apache.solr.update;
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Query;
 import org.apache.lucene.util.BytesRef;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
@@ -28,8 +27,6 @@ import org.apache.solr.request.SolrQuery
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 
-import java.util.List;
-
 /**
  *
  */
@@ -118,6 +115,35 @@ public class AddUpdateCommand extends Up
      return "(null)";
    }
 
+  /**
+   * @return String id to hash
+   */
+  public String getHashableId() {
+    String id = null;
+    IndexSchema schema = req.getSchema();
+    SchemaField sf = schema.getUniqueKeyField();
+    if (sf != null) {
+      if (solrDoc != null) {
+        SolrInputField field = solrDoc.getField(sf.getName());
+        
+        int count = field == null ? 0 : field.getValueCount();
+        if (count == 0) {
+          if (overwrite) {
+            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
+                "Document is missing mandatory uniqueKey field: "
+                    + sf.getName());
+          }
+        } else if (count > 1) {
+          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
+              "Document contains multiple values for uniqueKey field: " + field);
+        } else {
+          return field.getFirstValue().toString();
+        }
+      }
+    }
+    return id;
+  }
+  
    @Override
   public String toString() {
      StringBuilder sb = new StringBuilder(super.toString());

Modified: lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1379940&r1=1379939&r2=1379940&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
(original)
+++ lucene/dev/branches/lucene3312/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
Sun Sep  2 11:21:01 2012
@@ -1064,13 +1064,13 @@ public class DistributedUpdateProcessor 
   // make the hash pluggable of course.
   // The hash also needs to be pluggable
   private int hash(AddUpdateCommand cmd) {
-    BytesRef br = cmd.getIndexedId();
-    return Hash.murmurhash3_x86_32(br.bytes, br.offset, br.length, 0);
+    String hashableId = cmd.getHashableId();
+    
+    return Hash.murmurhash3_x86_32(hashableId, 0, hashableId.length(), 0);
   }
   
   private int hash(DeleteUpdateCommand cmd) {
-    BytesRef br = cmd.getIndexedId();
-    return Hash.murmurhash3_x86_32(br.bytes, br.offset, br.length, 0);
+    return Hash.murmurhash3_x86_32(cmd.getId(), 0, cmd.getId().length(), 0);
   }
   
   // RetryNodes are used in the case of 'forward to leader' where we want

Modified: lucene/dev/branches/lucene3312/solr/core/src/test-files/solr/collection1/conf/schema-folding.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/solr/core/src/test-files/solr/collection1/conf/schema-folding.xml?rev=1379940&r1=1379939&r2=1379940&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/solr/core/src/test-files/solr/collection1/conf/schema-folding.xml
(original)
+++ lucene/dev/branches/lucene3312/solr/core/src/test-files/solr/collection1/conf/schema-folding.xml
Sun Sep  2 11:21:01 2012
@@ -206,6 +206,16 @@
       </analyzer>
     </fieldType>
 
+    <fieldType name="text_fr" class="solr.TextField" positionIncrementGap="100">
+      <analyzer> 
+        <tokenizer class="solr.StandardTokenizerFactory"/>
+        <!-- removes l', etc -->
+        <filter class="solr.ElisionFilterFactory" ignoreCase="true" />
+        <filter class="solr.LowerCaseFilterFactory"/>
+        <filter class="solr.FrenchLightStemFilterFactory"/>
+      </analyzer>
+    </fieldType>
+
 
     <fieldType name="int" class="solr.TrieIntField" precisionStep="4" omitNorms="true"
positionIncrementGap="0"/>
     <fieldType name="float" class="solr.TrieFloatField" precisionStep="4" omitNorms="true"
positionIncrementGap="0"/>
@@ -250,6 +260,7 @@
     <dynamicField name="*_folding" type="text_folding" indexed="true" stored="true"/>
     <dynamicField name="*_stemming" type="text_stemming" indexed="true" stored="true"/>
     <dynamicField name="*_keyword" type="text_keyword" indexed="true" stored="true"/>
+    <dynamicField name="*_fr" type="text_fr" indexed="true" stored="true"/>
 
   </fields>
 

Modified: lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java?rev=1379940&r1=1379939&r2=1379940&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
(original)
+++ lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZk2Test.java
Sun Sep  2 11:21:01 2012
@@ -34,16 +34,16 @@ import org.apache.solr.common.params.Com
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.servlet.SolrDispatchFilter;
 
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action;
+
 /**
  * This test simply does a bunch of basic things in solrcloud mode and asserts things
  * work as expected.
  */
+@ThreadLeakAction({Action.WARN})
 public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
-  
-  public BasicDistributedZk2Test() {
-    super();
-  }
-  
+
   /*
    * (non-Javadoc)
    * 

Modified: lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=1379940&r1=1379939&r2=1379940&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
(original)
+++ lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
Sun Sep  2 11:21:01 2012
@@ -70,11 +70,15 @@ import org.apache.solr.common.util.Named
 import org.apache.solr.update.SolrCmdDistributor.Request;
 import org.apache.solr.util.DefaultSolrThreadFactory;
 
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakAction.Action;
+
 /**
  * This test simply does a bunch of basic things in solrcloud mode and asserts things
  * work as expected.
  */
 @Slow
+@ThreadLeakAction({Action.WARN})
 public class BasicDistributedZkTest extends AbstractDistribZkTestBase {
   
   private static final String DEFAULT_COLLECTION = "collection1";

Modified: lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java?rev=1379940&r1=1379939&r2=1379940&view=diff
==============================================================================
--- lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
(original)
+++ lucene/dev/branches/lucene3312/solr/core/src/test/org/apache/solr/search/QueryEqualityTest.java
Sun Sep  2 11:21:01 2012
@@ -329,6 +329,13 @@ public class QueryEqualityTest extends S
                      "div(field(foo_i), sub(4,bar_i))");
 
   }
+  public void testFuncMod() throws Exception {
+    assertFuncEquals("mod(5,4)", "mod(5, 4)");
+    assertFuncEquals("mod(foo_i,4)", "mod(foo_i, 4)", 
+                     "mod(field('foo_i'), 4)");
+    assertFuncEquals("mod(foo_i,sub(4,field('bar_i')))", 
+                     "mod(field(foo_i), sub(4,bar_i))");
+  }
   public void testFuncMap() throws Exception {
     assertFuncEquals("map(field(foo_i), 0, 45, 100)",
                      "map(foo_i, 0.0, 45, 100)");



Mime
View raw message