From d78f61db767ce051a46051183a31d37abd7586e1 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Sat, 22 Sep 2007 15:33:42 +0000 Subject: [PATCH] don't factor in +-Inf,NaN in scale function git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@578456 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/search/function/ScaleFloatFunction.java | 5 +++++ .../org/apache/solr/search/function/TestFunctionQuery.java | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/java/org/apache/solr/search/function/ScaleFloatFunction.java b/src/java/org/apache/solr/search/function/ScaleFloatFunction.java index 5f001b39573..1d7cace3a56 100755 --- a/src/java/org/apache/solr/search/function/ScaleFloatFunction.java +++ b/src/java/org/apache/solr/search/function/ScaleFloatFunction.java @@ -66,6 +66,11 @@ public class ScaleFloatFunction extends ValueSource { for (int i=0; i maxVal) { diff --git a/src/test/org/apache/solr/search/function/TestFunctionQuery.java b/src/test/org/apache/solr/search/function/TestFunctionQuery.java index d8013d3324d..157597b458f 100755 --- a/src/test/org/apache/solr/search/function/TestFunctionQuery.java +++ b/src/test/org/apache/solr/search/function/TestFunctionQuery.java @@ -128,6 +128,9 @@ public class TestFunctionQuery extends AbstractSolrTestCase { singleTest(field,"scale(\0,-1,1)",-4,-1, 100,1, 0,-0.9230769f); singleTest(field,"scale(\0,-10,1000)",-4,-10, 100,1000, 0,28.846153f); + // test that infinity doesn't mess up scale function + singleTest(field,"scale(log(\0),-1000,1000)",100,1000); + } public void testFunctions() {