Fix for SOLR-2987 (numeric keys in external file field stopped processing the rest of the file)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1229783 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2012-01-10 22:51:17 +00:00
parent ef4e44f30b
commit 7de1e259f1
3 changed files with 16 additions and 3 deletions

View File

@ -255,10 +255,9 @@ public class FileFloatSource extends ValueSource {
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) {

View File

@ -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

View File

@ -295,6 +295,18 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
singleTest(extField,"\0",991,543210,992,-8,993,250);
}
@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();