You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2012/01/10 23:51:17 UTC

svn commit: r1229783 - in /lucene/dev/trunk/solr/core/src: java/org/apache/solr/search/function/FileFloatSource.java test-files/solr/conf/schema11.xml test/org/apache/solr/search/function/TestFunctionQuery.java

Author: erick
Date: Tue Jan 10 22:51:17 2012
New Revision: 1229783

URL: http://svn.apache.org/viewvc?rev=1229783&view=rev
Log:
Fix for SOLR-2987 (numeric keys in external file field stopped processing the rest of the file)

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
    lucene/dev/trunk/solr/core/src/test-files/solr/conf/schema11.xml
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1229783&r1=1229782&r2=1229783&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java Tue Jan 10 22:51:17 2012
@@ -255,10 +255,9 @@ public class FileFloatSource extends Val
         String key = line.substring(0, delimIndex);
         String val = line.substring(delimIndex+1, endIndex);
 
-        idType.readableToIndexed(key, internalKey);
-
         float fval;
         try {
+          idType.readableToIndexed(key, internalKey);
           fval=Float.parseFloat(val);
         } catch (Exception e) {
           if (++otherErrors<=10) {

Modified: lucene/dev/trunk/solr/core/src/test-files/solr/conf/schema11.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/conf/schema11.xml?rev=1229783&r1=1229782&r2=1229783&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/conf/schema11.xml (original)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/conf/schema11.xml Tue Jan 10 22:51:17 2012
@@ -273,7 +273,7 @@ valued. -->
                stored="false" indexed="true"
                class="solr.ExternalFileField" valType="float"/>
 
-    <fieldType name="eff_tfloat" keyField="id" defVal="0"
+    <fieldType name="eff_tfloat" keyField="eff_ti" defVal="0"
                stored="false" indexed="true"
                class="solr.ExternalFileField" valType="tfloat"/>
 
@@ -320,6 +320,8 @@ valued. -->
 
    <field name="signatureField" type="string" indexed="true" stored="false"/>
 
+   <field name="eff_trie" type="eff_tfloat" />
+
    <!-- Dynamic field definitions.  If a field name is not found, dynamicFields
         will be used if the name matches any of the patterns.
         RESTRICTION: the glob-like pattern in the name attribute must have

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1229783&r1=1229782&r2=1229783&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java Tue Jan 10 22:51:17 2012
@@ -296,6 +296,18 @@ public class TestFunctionQuery extends S
   }
 
   @Test
+  public void testExternalFileFieldNumericKey() throws Exception {
+    final String extField = "eff_trie";
+    final String keyField = "eff_ti";
+    assertU(adoc("id", "991", keyField, "91"));
+    assertU(adoc("id", "992", keyField, "92"));
+    assertU(adoc("id", "993", keyField, "93"));
+    assertU(commit());
+    makeExternalFile(extField, "91=543210\n92=-8\n93=250\n=67","UTF-8");
+    singleTest(extField,"\0",991,543210,992,-8,993,250);
+  }
+
+  @Test
   public void testGeneral() throws Exception {
     clearIndex();