You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2011/07/15 21:14:02 UTC
svn commit: r1147284 - in /lucene/dev/trunk/solr: CHANGES.txt
core/src/java/org/apache/solr/search/function/FileFloatSource.java
core/src/test-files/solr/conf/schema11.xml
core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
Author: hossman
Date: Fri Jul 15 19:14:01 2011
New Revision: 1147284
URL: http://svn.apache.org/viewvc?rev=1147284&view=rev
Log:
SOLR-2545: fix ExternalFileField / FileFloatSource so it can properly parse key=val pairs when the key contains an '=' char
Modified:
lucene/dev/trunk/solr/CHANGES.txt
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/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1147284&r1=1147283&r2=1147284&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Jul 15 19:14:01 2011
@@ -375,6 +375,11 @@ Bug Fixes
* SOLR-2642: Fixed sorting by function when using grouping. (Thomas Heigl, Martijn van Groningen)
+* SOLR-2545: ExternalFileField file parsing would fail if any key
+ contained an "=" character. It now only looks for the last "=" delimiter
+ prior to the float value.
+ (Markus Jelsma, hossman)
+
Other Changes
----------------------
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=1147284&r1=1147283&r2=1147284&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 Fri Jul 15 19:14:01 2011
@@ -248,7 +248,7 @@ public class FileFloatSource extends Val
// final Bits liveDocs = MultiFields.getLiveDocs(reader);
for (String line; (line=r.readLine())!=null;) {
- int delimIndex = line.indexOf(delimiter);
+ int delimIndex = line.lastIndexOf(delimiter);
if (delimIndex < 0) continue;
int endIndex = line.length();
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=1147284&r1=1147283&r2=1147284&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 Fri Jul 15 19:14:01 2011
@@ -239,6 +239,8 @@
<fieldType name="file" keyField="id" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" valType="float"/>
+ <fieldType name="sfile" keyField="sfile_s" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" valType="float"/>
+
<fieldType name="tint" class="solr.TrieIntField" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" omitNorms="true" positionIncrementGap="0"/>
@@ -340,6 +342,7 @@ valued. -->
<dynamicField name="*_ws" type="text_ws" indexed="true" stored="true"/>
<dynamicField name="*_extf" type="file"/>
+ <dynamicField name="*_extfs" type="sfile"/>
<dynamicField name="*_random" type="random" />
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=1147284&r1=1147283&r2=1147284&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 Fri Jul 15 19:14:01 2011
@@ -284,6 +284,18 @@ public class TestFunctionQuery extends S
}
@Test
+ public void testExternalFileFieldStringKeys() throws Exception {
+ final String extField = "foo_extfs";
+ final String keyField = "sfile_s";
+ assertU(adoc("id", "991", keyField, "AAA=AAA"));
+ assertU(adoc("id", "992", keyField, "BBB"));
+ assertU(adoc("id", "993", keyField, "CCC=CCC"));
+ assertU(commit());
+ makeExternalFile(extField, "AAA=AAA=543210\nBBB=-8\nCCC=CCC=250","UTF-8");
+ singleTest(extField,"\0",991,543210,992,-8,993,250);
+ }
+
+ @Test
public void testGeneral() throws Exception {
clearIndex();