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:50:43 UTC
svn commit: r1229782 - in /lucene/dev/branches/branch_3x/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:50:43 2012
New Revision: 1229782
URL: http://svn.apache.org/viewvc?rev=1229782&view=rev
Log:
Fix for SOLR-2987 (numeric keys in external file field stopped processing the rest of the file)
Modified:
lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
lucene/dev/branches/branch_3x/solr/core/src/test-files/solr/conf/schema11.xml
lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
Modified: lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java?rev=1229782&r1=1229781&r2=1229782&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java (original)
+++ lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/search/function/FileFloatSource.java Tue Jan 10 22:50:43 2012
@@ -299,9 +299,10 @@ public class FileFloatSource extends Val
String key = line.substring(0, delimIndex);
String val = line.substring(delimIndex+1, endIndex);
- String internalKey = idType.toInternal(key);
+ String internalKey = "";
float fval;
try {
+ internalKey = idType.toInternal(key);
fval=Float.parseFloat(val);
} catch (Exception e) {
if (++otherErrors<=10) {
Modified: lucene/dev/branches/branch_3x/solr/core/src/test-files/solr/conf/schema11.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/test-files/solr/conf/schema11.xml?rev=1229782&r1=1229781&r2=1229782&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/test-files/solr/conf/schema11.xml (original)
+++ lucene/dev/branches/branch_3x/solr/core/src/test-files/solr/conf/schema11.xml Tue Jan 10 22:50:43 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"/>
@@ -318,6 +318,9 @@ valued. -->
<field name="point_hash" type="geohash" indexed="true" stored="true" multiValued="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/branches/branch_3x/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1229782&r1=1229781&r2=1229782&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/branch_3x/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java Tue Jan 10 22:50:43 2012
@@ -284,6 +284,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();