lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r893806 - in /lucene/solr/trunk/src: java/org/apache/solr/schema/PointType.java java/org/apache/solr/schema/SchemaField.java test/org/apache/solr/schema/PolyFieldTest.java test/test-files/solr/conf/schema.xml
Date Thu, 24 Dec 2009 19:56:44 GMT
Author: yonik
Date: Thu Dec 24 19:56:40 2009
New Revision: 893806

URL: http://svn.apache.org/viewvc?rev=893806&view=rev
Log:
SOLR-1131: fix equals,hashcode of PointTypeValueSource and test that fails w/o the fix

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java
    lucene/solr/trunk/src/java/org/apache/solr/schema/SchemaField.java
    lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java
    lucene/solr/trunk/src/test/test-files/solr/conf/schema.xml

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java?rev=893806&r1=893805&r2=893806&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java Thu Dec 24 19:56:40 2009
@@ -258,15 +258,12 @@
 
       if (dimension != that.dimension) return false;
       if (!field.equals(that.field)) return false;
-      if (!subType.equals(that.subType)) return false;
-
       return true;
     }
 
     @Override
     public int hashCode() {
       int result = field.hashCode();
-      result = 31 * result + subType.hashCode();
       result = 31 * result + dimension;
       return result;
     }

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/SchemaField.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/SchemaField.java?rev=893806&r1=893805&r2=893806&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/SchemaField.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/SchemaField.java Thu Dec 24 19:56:40
2009
@@ -209,6 +209,16 @@
   public String getDefaultValue() {
     return defaultValue;
   }
+
+  @Override
+  public int hashCode() {
+    return name.hashCode();
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    return(obj instanceof SchemaField) && name.equals(((SchemaField)obj).name);
+  }
 }
 
 

Modified: lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java?rev=893806&r1=893805&r2=893806&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java Thu Dec 24 19:56:40
2009
@@ -27,6 +27,7 @@
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.util.AbstractSolrTestCase;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.search.function.ValueSource;
 
 import java.util.Map;
 import java.util.Random;
@@ -118,6 +119,14 @@
     } catch (Exception e) {
       //
     }
+
+    //
+    SchemaField s1 = schema.getField("test_p");
+    SchemaField s2 = schema.getField("test_p");
+    ValueSource v1 = s1.getType().getValueSource(s1,null);
+    ValueSource v2 = s2.getType().getValueSource(s2,null);
+    assertEquals(v1,v2);
+    assertEquals(v1.hashCode(),v2.hashCode());
   }
 
   public void testSearching() throws Exception {
@@ -125,11 +134,7 @@
       assertU(adoc("id", "" + i, "home", i + "," + (i * 100), "homed", (i * 1000) + "," +
(i * 10000)));
     }
     assertU(commit());
-    IndexReader reader = h.getCore().getSearcher().get().getReader();
-    /*for (int i = 0; i < 50; i++){
-      Document doc = reader.document(i);
-      System.out.println("Doc: " + doc.get("homed_0___double"));
-    }*/
+
     assertQ(req("fl", "*,score", "q", "*:*"), "//*[@numFound='50']");
     assertQ(req("fl", "*,score", "q", "home:1,100"),
             "//*[@numFound='1']",

Modified: lucene/solr/trunk/src/test/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/test-files/solr/conf/schema.xml?rev=893806&r1=893805&r2=893806&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/test-files/solr/conf/schema.xml (original)
+++ lucene/solr/trunk/src/test/test-files/solr/conf/schema.xml Thu Dec 24 19:56:40 2009
@@ -520,6 +520,8 @@
    <dynamicField name="tv_mv_*"  type="text" indexed="true"  stored="true" multiValued="true"
       termVectors="true" termPositions="true" termOffsets="true"/>
 
+   <dynamicField name="*_p"  type="xyd" indexed="true"  stored="true" multiValued="false"/>

+
    <!-- special fields for dynamic copyField test -->
    <dynamicField name="dynamic_*" type="string" indexed="true" stored="true"/>
    <dynamicField name="*_dynamic" type="string" indexed="true" stored="true"/>



Mime
View raw message