mirror of https://github.com/apache/lucene.git
LUCENE-3419: Added epsilons and fixed deprecated junit assertion usage
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1166582 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa93e73225
commit
c0f05e7b37
|
@ -292,7 +292,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertEquals( 1, qpm.subMap.size() );
|
||||
assertTrue( qpm.subMap.get( "a" ) != null );
|
||||
assertTrue( qpm.subMap.get( "a" ).terminal );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0);
|
||||
|
||||
// phraseHighlight = true, fieldMatch = false
|
||||
fq = new FieldQuery( query, true, false );
|
||||
|
@ -304,7 +304,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertEquals( 1, qpm.subMap.size() );
|
||||
assertTrue( qpm.subMap.get( "a" ) != null );
|
||||
assertTrue( qpm.subMap.get( "a" ).terminal );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0);
|
||||
|
||||
// phraseHighlight = false, fieldMatch = true
|
||||
fq = new FieldQuery( query, false, true );
|
||||
|
@ -316,7 +316,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertEquals( 1, qpm.subMap.size() );
|
||||
assertTrue( qpm.subMap.get( "a" ) != null );
|
||||
assertTrue( qpm.subMap.get( "a" ).terminal );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0);
|
||||
|
||||
// phraseHighlight = false, fieldMatch = false
|
||||
fq = new FieldQuery( query, false, false );
|
||||
|
@ -328,14 +328,14 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertEquals( 1, qpm.subMap.size() );
|
||||
assertTrue( qpm.subMap.get( "a" ) != null );
|
||||
assertTrue( qpm.subMap.get( "a" ).terminal );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost );
|
||||
assertEquals( 1F, qpm.subMap.get( "a" ).boost, 0);
|
||||
|
||||
// boost != 1
|
||||
query = tq( 2, "a" );
|
||||
fq = new FieldQuery( query, true, true );
|
||||
map = fq.rootMaps;
|
||||
qpm = map.get( F );
|
||||
assertEquals( 2F, qpm.subMap.get( "a" ).boost );
|
||||
assertEquals( 2F, qpm.subMap.get( "a" ).boost, 0);
|
||||
}
|
||||
|
||||
public void testQueryPhraseMap1Phrase() throws Exception {
|
||||
|
@ -356,7 +356,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// phraseHighlight = true, fieldMatch = false
|
||||
fq = new FieldQuery( query, true, false );
|
||||
|
@ -373,7 +373,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// phraseHighlight = false, fieldMatch = true
|
||||
fq = new FieldQuery( query, false, true );
|
||||
|
@ -386,17 +386,17 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm.subMap.get( "a" ) );
|
||||
qpm2 = qpm.subMap.get( "a" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
assertEquals( 1, qpm2.subMap.size() );
|
||||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
assertNotNull( qpm.subMap.get( "b" ) );
|
||||
qpm2 = qpm.subMap.get( "b" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
|
||||
// phraseHighlight = false, fieldMatch = false
|
||||
fq = new FieldQuery( query, false, false );
|
||||
|
@ -409,17 +409,17 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm.subMap.get( "a" ) );
|
||||
qpm2 = qpm.subMap.get( "a" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
assertEquals( 1, qpm2.subMap.size() );
|
||||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
assertNotNull( qpm.subMap.get( "b" ) );
|
||||
qpm2 = qpm.subMap.get( "b" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
|
||||
// boost != 1
|
||||
query = pqF( 2, "a", "b" );
|
||||
|
@ -428,11 +428,11 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
map = fq.rootMaps;
|
||||
qpm = map.get( null );
|
||||
qpm2 = qpm.subMap.get( "a" );
|
||||
assertEquals( 2F, qpm2.boost );
|
||||
assertEquals( 2F, qpm2.boost, 0);
|
||||
qpm3 = qpm2.subMap.get( "b" );
|
||||
assertEquals( 2F, qpm3.boost );
|
||||
assertEquals( 2F, qpm3.boost, 0);
|
||||
qpm2 = qpm.subMap.get( "b" );
|
||||
assertEquals( 2F, qpm2.boost );
|
||||
assertEquals( 2F, qpm2.boost, 0);
|
||||
}
|
||||
|
||||
public void testQueryPhraseMap1PhraseAnother() throws Exception {
|
||||
|
@ -453,7 +453,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "engines" ) );
|
||||
QueryPhraseMap qpm3 = qpm2.subMap.get( "engines" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
}
|
||||
|
||||
public void testQueryPhraseMap2Phrases() throws Exception {
|
||||
|
@ -478,7 +478,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "c d"^2
|
||||
assertNotNull( qpm.subMap.get( "c" ) );
|
||||
|
@ -488,7 +488,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "d" ) );
|
||||
qpm3 = qpm2.subMap.get( "d" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 2F, qpm3.boost );
|
||||
assertEquals( 2F, qpm3.boost, 0);
|
||||
}
|
||||
|
||||
public void testQueryPhraseMap2PhrasesFields() throws Exception {
|
||||
|
@ -513,7 +513,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "c d"^2
|
||||
assertNotNull( map.get( F2 ) );
|
||||
|
@ -526,7 +526,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "d" ) );
|
||||
qpm3 = qpm2.subMap.get( "d" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 2F, qpm3.boost );
|
||||
assertEquals( 2F, qpm3.boost, 0);
|
||||
|
||||
// phraseHighlight = true, fieldMatch = false
|
||||
fq = new FieldQuery( query, true, false );
|
||||
|
@ -546,7 +546,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "c d"^2
|
||||
assertNotNull( qpm.subMap.get( "c" ) );
|
||||
|
@ -556,7 +556,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "d" ) );
|
||||
qpm3 = qpm2.subMap.get( "d" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 2F, qpm3.boost );
|
||||
assertEquals( 2F, qpm3.boost, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -594,11 +594,11 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm3.subMap.get( "c" ) );
|
||||
QueryPhraseMap qpm4 = qpm3.subMap.get( "c" );
|
||||
assertTrue( qpm4.terminal );
|
||||
assertEquals( 1F, qpm4.boost );
|
||||
assertEquals( 1F, qpm4.boost, 0);
|
||||
assertNotNull( qpm4.subMap.get( "d" ) );
|
||||
QueryPhraseMap qpm5 = qpm4.subMap.get( "d" );
|
||||
assertTrue( qpm5.terminal );
|
||||
assertEquals( 1F, qpm5.boost );
|
||||
assertEquals( 1F, qpm5.boost, 0);
|
||||
|
||||
// "b c d"^2, "b d"^3
|
||||
assertNotNull( qpm.subMap.get( "b" ) );
|
||||
|
@ -612,11 +612,11 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm3.subMap.get( "d" ) );
|
||||
qpm4 = qpm3.subMap.get( "d" );
|
||||
assertTrue( qpm4.terminal );
|
||||
assertEquals( 2F, qpm4.boost );
|
||||
assertEquals( 2F, qpm4.boost, 0);
|
||||
assertNotNull( qpm2.subMap.get( "d" ) );
|
||||
qpm3 = qpm2.subMap.get( "d" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 3F, qpm3.boost );
|
||||
assertEquals( 3F, qpm3.boost, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -647,14 +647,14 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "b" ) );
|
||||
QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "a b c"^2
|
||||
assertEquals( 1, qpm3.subMap.size() );
|
||||
assertNotNull( qpm3.subMap.get( "c" ) );
|
||||
QueryPhraseMap qpm4 = qpm3.subMap.get( "c" );
|
||||
assertTrue( qpm4.terminal );
|
||||
assertEquals( 2F, qpm4.boost );
|
||||
assertEquals( 2F, qpm4.boost, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -733,14 +733,14 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "bc" ) );
|
||||
QueryPhraseMap qpm3 = qpm2.subMap.get( "bc" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "ab bc cd"
|
||||
assertEquals( 1, qpm3.subMap.size() );
|
||||
assertNotNull( qpm3.subMap.get( "cd" ) );
|
||||
QueryPhraseMap qpm4 = qpm3.subMap.get( "cd" );
|
||||
assertTrue( qpm4.terminal );
|
||||
assertEquals( 1F, qpm4.boost );
|
||||
assertEquals( 1F, qpm4.boost, 0);
|
||||
|
||||
// "bc cd"
|
||||
assertNotNull( qpm.subMap.get( "bc" ) );
|
||||
|
@ -750,7 +750,7 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm2.subMap.get( "cd" ) );
|
||||
qpm3 = qpm2.subMap.get( "cd" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// phraseHighlight = false, fieldMatch = true
|
||||
fq = new FieldQuery( query, false, true );
|
||||
|
@ -765,36 +765,36 @@ public class FieldQueryTest extends AbstractTestCase {
|
|||
assertNotNull( qpm.subMap.get( "ab" ) );
|
||||
qpm2 = qpm.subMap.get( "ab" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
assertEquals( 1, qpm2.subMap.size() );
|
||||
assertNotNull( qpm2.subMap.get( "bc" ) );
|
||||
qpm3 = qpm2.subMap.get( "bc" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "ab bc cd"
|
||||
assertEquals( 1, qpm3.subMap.size() );
|
||||
assertNotNull( qpm3.subMap.get( "cd" ) );
|
||||
qpm4 = qpm3.subMap.get( "cd" );
|
||||
assertTrue( qpm4.terminal );
|
||||
assertEquals( 1F, qpm4.boost );
|
||||
assertEquals( 1F, qpm4.boost, 0);
|
||||
|
||||
// "bc cd"
|
||||
assertNotNull( qpm.subMap.get( "bc" ) );
|
||||
qpm2 = qpm.subMap.get( "bc" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
assertEquals( 1, qpm2.subMap.size() );
|
||||
assertNotNull( qpm2.subMap.get( "cd" ) );
|
||||
qpm3 = qpm2.subMap.get( "cd" );
|
||||
assertTrue( qpm3.terminal );
|
||||
assertEquals( 1F, qpm3.boost );
|
||||
assertEquals( 1F, qpm3.boost, 0);
|
||||
|
||||
// "cd"
|
||||
assertNotNull( qpm.subMap.get( "cd" ) );
|
||||
qpm2 = qpm.subMap.get( "cd" );
|
||||
assertTrue( qpm2.terminal );
|
||||
assertEquals( 1F, qpm2.boost );
|
||||
assertEquals( 1F, qpm2.boost, 0);
|
||||
assertEquals( 0, qpm2.subMap.size() );
|
||||
}
|
||||
|
||||
|
|
|
@ -33,28 +33,28 @@ public class DistanceUtilsTest extends LuceneTestCase {
|
|||
double[] oneOne = new double[]{1, 1};
|
||||
double[] pt1 = new double[]{1.5, 110.3};
|
||||
double[] result = DistanceUtils.vectorBoxCorner(zero, null, Math.sqrt(2), true);
|
||||
assertEquals(1.0, result[0]);
|
||||
assertEquals(1.0, result[1]);
|
||||
assertEquals(1.0, result[0], 0);
|
||||
assertEquals(1.0, result[1], 0);
|
||||
|
||||
result = DistanceUtils.vectorBoxCorner(zero, null, Math.sqrt(2), false);
|
||||
assertEquals(-1.0, result[0]);
|
||||
assertEquals(-1.0, result[1]);
|
||||
assertEquals(-1.0, result[0], 0);
|
||||
assertEquals(-1.0, result[1], 0);
|
||||
|
||||
result = DistanceUtils.vectorBoxCorner(oneOne, null, Math.sqrt(2), true);
|
||||
assertEquals(2.0, result[0]);
|
||||
assertEquals(2.0, result[1]);
|
||||
assertEquals(2.0, result[0], 0);
|
||||
assertEquals(2.0, result[1], 0);
|
||||
|
||||
result = DistanceUtils.vectorBoxCorner(zeroOne, null, Math.sqrt(2), true);
|
||||
assertEquals(1.0, result[0]);
|
||||
assertEquals(2.0, result[1]);
|
||||
assertEquals(1.0, result[0], 0);
|
||||
assertEquals(2.0, result[1], 0);
|
||||
|
||||
result = DistanceUtils.vectorBoxCorner(pt1, null, Math.sqrt(2), true);
|
||||
assertEquals(2.5, result[0]);
|
||||
assertEquals(111.3, result[1]);
|
||||
assertEquals(2.5, result[0], 0.1);
|
||||
assertEquals(111.3, result[1], 0.1);
|
||||
|
||||
result = DistanceUtils.vectorBoxCorner(pt1, null, Math.sqrt(2), false);
|
||||
assertEquals(0.5, result[0]);
|
||||
assertEquals(109.3, result[1]);
|
||||
assertEquals(0.5, result[0], 0.1);
|
||||
assertEquals(109.3, result[1], 0.1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -152,9 +152,9 @@ public class DistanceUtilsTest extends LuceneTestCase {
|
|||
double[] oneOne = new double[]{1, 1};
|
||||
double distance;
|
||||
distance = DistanceUtils.vectorDistance(zero, zeroOne, 2);
|
||||
assertEquals(1.0, distance);
|
||||
assertEquals(1.0, distance, 0);
|
||||
distance = DistanceUtils.vectorDistance(zero, oneZero, 2);
|
||||
assertEquals(1.0, distance);
|
||||
assertEquals(1.0, distance, 0);
|
||||
distance = DistanceUtils.vectorDistance(zero, oneOne, 2);
|
||||
assertEquals(Math.sqrt(2), distance, 0.001);
|
||||
|
||||
|
@ -248,9 +248,9 @@ public class DistanceUtilsTest extends LuceneTestCase {
|
|||
|
||||
double[] dbls = DistanceUtils.parsePointDouble(null, "89.0 , 73.2 , -92.3", 3);
|
||||
assertEquals(3, dbls.length);
|
||||
assertEquals(89.0, dbls[0]);
|
||||
assertEquals(73.2, dbls[1]);
|
||||
assertEquals(-92.3, dbls[2]);
|
||||
assertEquals(89.0, dbls[0], 0);
|
||||
assertEquals(73.2, dbls[1], 0.1);
|
||||
assertEquals(-92.3, dbls[2], 0.1);
|
||||
|
||||
try {
|
||||
dbls = DistanceUtils.parsePointDouble(null, "89.0 , foo , -92.3", 3);
|
||||
|
@ -260,8 +260,8 @@ public class DistanceUtilsTest extends LuceneTestCase {
|
|||
|
||||
dbls = DistanceUtils.parseLatitudeLongitude(null, "89.0 , 73.2 ");
|
||||
assertEquals(2, dbls.length);
|
||||
assertEquals(89.0, dbls[0]);
|
||||
assertEquals(73.2, dbls[1]);
|
||||
assertEquals(89.0, dbls[0], 0.1);
|
||||
assertEquals(73.2, dbls[1], 0.1);
|
||||
|
||||
//test some bad lat/long pairs
|
||||
try {
|
||||
|
|
|
@ -154,12 +154,12 @@ public class TestCartesian extends LuceneTestCase {
|
|||
System.out.println("testDistances");
|
||||
System.out.println("miles:" + miles);
|
||||
}
|
||||
assertEquals(2288.82495932794, miles);
|
||||
assertEquals(2288.82495932794, miles, 0.001);
|
||||
LatLng p3 = new FloatLatLng( 41.6032207, -73.087749);
|
||||
LatLng p4 = new FloatLatLng( 55.0, 4.0 );
|
||||
miles = p3.arcDistance( p4, DistanceUnits.MILES );
|
||||
if (VERBOSE) System.out.println("miles:" + miles);
|
||||
assertEquals(3474.331719997617, miles);
|
||||
assertEquals(3474.331719997617, miles, 0.001);
|
||||
}
|
||||
|
||||
/*public void testCartesianPolyFilterBuilder() throws Exception {
|
||||
|
|
|
@ -487,7 +487,7 @@ public class _TestUtil {
|
|||
Assert.assertEquals("wrong hit score", expectedSD.score, actualSD.score, 0.0);
|
||||
if (expectedSD instanceof FieldDoc) {
|
||||
Assert.assertTrue(actualSD instanceof FieldDoc);
|
||||
Assert.assertEquals("wrong sort field values",
|
||||
Assert.assertArrayEquals("wrong sort field values",
|
||||
((FieldDoc) expectedSD).fields,
|
||||
((FieldDoc) actualSD).fields);
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TestConstantScoreQuery extends LuceneTestCase {
|
|||
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
assertEquals("Score differs from expected", expectedScore, this.scorer.score());
|
||||
assertEquals("Score differs from expected", expectedScore, this.scorer.score(), 0);
|
||||
count[0]++;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ public class TestMultiTermConstantScore extends BaseTestRangeFilter {
|
|||
float score = result[0].score;
|
||||
for (int i = 1; i < numHits; i++) {
|
||||
assertEquals("score for " + i + " was not the same", score,
|
||||
result[i].score);
|
||||
result[i].score, SCORE_COMP_THRESH);
|
||||
}
|
||||
|
||||
result = search.search(csrq("data", "1", "6", T, T, MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE), null, 1000).scoreDocs;
|
||||
|
@ -159,7 +159,7 @@ public class TestMultiTermConstantScore extends BaseTestRangeFilter {
|
|||
assertEquals("wrong number of results", 6, numHits);
|
||||
for (int i = 0; i < numHits; i++) {
|
||||
assertEquals("score for " + i + " was not the same", score,
|
||||
result[i].score);
|
||||
result[i].score, SCORE_COMP_THRESH);
|
||||
}
|
||||
|
||||
search.close();
|
||||
|
@ -184,7 +184,7 @@ public class TestMultiTermConstantScore extends BaseTestRangeFilter {
|
|||
}
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
assertEquals("score for doc " + (doc + base) + " was not correct", 1.0f, scorer.score());
|
||||
assertEquals("score for doc " + (doc + base) + " was not correct", 1.0f, scorer.score(), SCORE_COMP_THRESH);
|
||||
}
|
||||
@Override
|
||||
public void setNextReader(AtomicReaderContext context) {
|
||||
|
|
|
@ -149,7 +149,7 @@ public class TestMultiTermQueryRewrites extends LuceneTestCase {
|
|||
for (BooleanClause clause : bq.clauses()) {
|
||||
final TermQuery mtq = (TermQuery) clause.getQuery();
|
||||
assertEquals("Parallel sorting of boosts in rewrite mode broken",
|
||||
Float.parseFloat(mtq.getTerm().text()), mtq.getBoost());
|
||||
Float.parseFloat(mtq.getTerm().text()), mtq.getBoost(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class TestSimilarity extends LuceneTestCase {
|
|||
}
|
||||
@Override
|
||||
public final void collect(int doc) throws IOException {
|
||||
assertEquals(1.0f, scorer.score());
|
||||
assertEquals(1.0f, scorer.score(), 0);
|
||||
}
|
||||
@Override
|
||||
public void setNextReader(AtomicReaderContext context) {}
|
||||
|
@ -110,7 +110,7 @@ public class TestSimilarity extends LuceneTestCase {
|
|||
@Override
|
||||
public final void collect(int doc) throws IOException {
|
||||
//System.out.println("Doc=" + doc + " score=" + score);
|
||||
assertEquals((float)doc+base+1, scorer.score());
|
||||
assertEquals((float)doc+base+1, scorer.score(), 0);
|
||||
}
|
||||
@Override
|
||||
public void setNextReader(AtomicReaderContext context) {
|
||||
|
@ -136,7 +136,7 @@ public class TestSimilarity extends LuceneTestCase {
|
|||
@Override
|
||||
public final void collect(int doc) throws IOException {
|
||||
//System.out.println("Doc=" + doc + " score=" + score);
|
||||
assertEquals(1.0f, scorer.score());
|
||||
assertEquals(1.0f, scorer.score(), 0);
|
||||
}
|
||||
@Override
|
||||
public void setNextReader(AtomicReaderContext context) {}
|
||||
|
@ -157,7 +157,7 @@ public class TestSimilarity extends LuceneTestCase {
|
|||
@Override
|
||||
public final void collect(int doc) throws IOException {
|
||||
//System.out.println("Doc=" + doc + " score=" + score);
|
||||
assertEquals(2.0f, scorer.score());
|
||||
assertEquals(2.0f, scorer.score(), 0);
|
||||
}
|
||||
@Override
|
||||
public void setNextReader(AtomicReaderContext context) {}
|
||||
|
|
|
@ -76,25 +76,25 @@ public class TestWildcard
|
|||
wq.setBoost(0.1F);
|
||||
Query q = searcher.rewrite(wq);
|
||||
assertTrue(q instanceof TermQuery);
|
||||
assertEquals(q.getBoost(), wq.getBoost());
|
||||
assertEquals(q.getBoost(), wq.getBoost(), 0);
|
||||
|
||||
wq.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
|
||||
wq.setBoost(0.2F);
|
||||
q = searcher.rewrite(wq);
|
||||
assertTrue(q instanceof ConstantScoreQuery);
|
||||
assertEquals(q.getBoost(), wq.getBoost());
|
||||
assertEquals(q.getBoost(), wq.getBoost(), 0.1);
|
||||
|
||||
wq.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
|
||||
wq.setBoost(0.3F);
|
||||
q = searcher.rewrite(wq);
|
||||
assertTrue(q instanceof ConstantScoreQuery);
|
||||
assertEquals(q.getBoost(), wq.getBoost());
|
||||
assertEquals(q.getBoost(), wq.getBoost(), 0.1);
|
||||
|
||||
wq.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
|
||||
wq.setBoost(0.4F);
|
||||
q = searcher.rewrite(wq);
|
||||
assertTrue(q instanceof ConstantScoreQuery);
|
||||
assertEquals(q.getBoost(), wq.getBoost());
|
||||
assertEquals(q.getBoost(), wq.getBoost(), 0.1);
|
||||
searcher.close();
|
||||
indexStore.close();
|
||||
}
|
||||
|
|
|
@ -906,7 +906,7 @@ public class TestGrouping extends LuceneTestCase {
|
|||
|
||||
assertEquals(group1.groupValue, group2.groupValue);
|
||||
if (doSortValues) {
|
||||
assertEquals(group1.sortValues, group2.sortValues);
|
||||
assertArrayEquals(group1.sortValues, group2.sortValues);
|
||||
}
|
||||
}
|
||||
assertFalse(iter2.hasNext());
|
||||
|
@ -1009,7 +1009,7 @@ public class TestGrouping extends LuceneTestCase {
|
|||
//System.out.println(" actual doc=" + docIDtoID[actualFD.doc] + " score=" + actualFD.score);
|
||||
assertEquals(expectedFD.doc, docIDtoID[actualFD.doc]);
|
||||
if (testScores) {
|
||||
assertEquals(expectedFD.score, actualFD.score);
|
||||
assertEquals(expectedFD.score, actualFD.score, 0.1);
|
||||
} else {
|
||||
// TODO: too anal for now
|
||||
//assertEquals(Float.NaN, actualFD.score);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
|||
AddUpdateCommand add = p.addCommands.get(0);
|
||||
SolrInputDocument d = add.solrDoc;
|
||||
SolrInputField f = d.getField( "boosted" );
|
||||
assertEquals(6.7f, f.getBoost());
|
||||
assertEquals(6.7f, f.getBoost(), 0.1);
|
||||
assertEquals(2, f.getValues().size());
|
||||
|
||||
//
|
||||
|
@ -102,7 +102,7 @@ public class JsonLoaderTest extends SolrTestCaseJ4 {
|
|||
d = add.solrDoc;
|
||||
f = d.getField( "f1" );
|
||||
assertEquals(2, f.getValues().size());
|
||||
assertEquals(3.45f, d.getDocumentBoost());
|
||||
assertEquals(3.45f, d.getDocumentBoost(), 0.001);
|
||||
assertEquals(false, add.overwrite);
|
||||
|
||||
assertEquals(0, d.getField("f2").getValueCount());
|
||||
|
|
|
@ -62,11 +62,11 @@ public class XmlUpdateRequestHandlerTest extends SolrTestCaseJ4 {
|
|||
SolrInputDocument doc = loader.readDoc( parser );
|
||||
|
||||
// Read boosts
|
||||
assertEquals( 5.5f, doc.getDocumentBoost() );
|
||||
assertEquals( 1.0f, doc.getField( "name" ).getBoost() );
|
||||
assertEquals( 2.2f, doc.getField( "id" ).getBoost() );
|
||||
assertEquals( 5.5f, doc.getDocumentBoost(), 0.1);
|
||||
assertEquals( 1.0f, doc.getField( "name" ).getBoost(), 0.1);
|
||||
assertEquals( 2.2f, doc.getField( "id" ).getBoost(), 0.1);
|
||||
// Boost is the product of each value
|
||||
assertEquals( (3*4*5.0f), doc.getField( "cat" ).getBoost() );
|
||||
assertEquals( (3*4*5.0f), doc.getField( "cat" ).getBoost(), 0.1);
|
||||
|
||||
// Read values
|
||||
assertEquals( "12345", doc.getField( "id" ).getValue() );
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TestUtils extends LuceneTestCase {
|
|||
{
|
||||
double number = 1.234;
|
||||
String sortable = NumberUtils.double2sortableStr( number );
|
||||
assertEquals( number, NumberUtils.SortableStr2double(sortable) );
|
||||
assertEquals( number, NumberUtils.SortableStr2double(sortable), 0.001);
|
||||
|
||||
long num = System.currentTimeMillis();
|
||||
sortable = NumberUtils.long2sortableStr( num );
|
||||
|
|
|
@ -195,7 +195,7 @@ public class SolrQueryTest extends LuceneTestCase {
|
|||
|
||||
// check getters
|
||||
assertEquals(false, q.getTerms());
|
||||
assertEquals(null, q.getTermsFields());
|
||||
assertArrayEquals(null, q.getTermsFields());
|
||||
assertEquals("", q.getTermsLower());
|
||||
assertEquals("", q.getTermsUpper());
|
||||
assertEquals(false, q.getTermsUpperInclusive());
|
||||
|
@ -207,7 +207,7 @@ public class SolrQueryTest extends LuceneTestCase {
|
|||
assertEquals(false, q.getTermsRaw());
|
||||
assertEquals("count", q.getTermsSortString());
|
||||
assertEquals(null, q.getTermsRegex());
|
||||
assertEquals(null, q.getTermsRegexFlags());
|
||||
assertArrayEquals(null, q.getTermsRegexFlags());
|
||||
|
||||
// check setters
|
||||
q.setTerms(true);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ModifiableSolrParamsTest extends LuceneTestCase
|
|||
values[0] = null;
|
||||
modifiable.add(key, values);
|
||||
String[] result = modifiable.getParams(key);
|
||||
assertEquals("params", values, result);
|
||||
assertArrayEquals("params", values, result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class ModifiableSolrParamsTest extends LuceneTestCase
|
|||
String[] universe = new String[] { "Universe" };
|
||||
String[] helloWorldUniverse = new String[] { "Hello", "World", "Universe" };
|
||||
modifiable.add(key, helloWorld);
|
||||
assertEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
assertArrayEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
|
||||
modifiable.add(key, universe);
|
||||
String[] result = modifiable.getParams(key);
|
||||
|
@ -73,7 +73,7 @@ public class ModifiableSolrParamsTest extends LuceneTestCase
|
|||
String[] universe = new String[] { null };
|
||||
String[] helloWorldUniverse = new String[] { "Hello", "World", null };
|
||||
modifiable.add(key, helloWorld);
|
||||
assertEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
assertArrayEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
|
||||
modifiable.add(key, universe);
|
||||
String[] result = modifiable.getParams(key);
|
||||
|
@ -89,7 +89,7 @@ public class ModifiableSolrParamsTest extends LuceneTestCase
|
|||
String[] universe = new String[] { "Universe" };
|
||||
String[] helloWorldUniverse = new String[] { "Universe" };
|
||||
modifiable.add(key, helloWorld);
|
||||
assertEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
assertArrayEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
|
||||
modifiable.add(key, universe);
|
||||
String[] result = modifiable.getParams(key);
|
||||
|
@ -105,7 +105,7 @@ public class ModifiableSolrParamsTest extends LuceneTestCase
|
|||
String[] universe = new String[] { "Universe", null };
|
||||
String[] helloWorldUniverse = new String[] { "Hello", "World", "Universe", null };
|
||||
modifiable.add(key, helloWorld);
|
||||
assertEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
assertArrayEquals("checking Hello World: ", helloWorld, modifiable.getParams(key));
|
||||
|
||||
modifiable.add(key, universe);
|
||||
String[] result = modifiable.getParams(key);
|
||||
|
|
|
@ -108,10 +108,10 @@ public class SolrParamTest extends LuceneTestCase
|
|||
assertEquals( pstr , params.get( "xxx", pstr ) );
|
||||
assertEquals( pbool.booleanValue() , params.getBool( "xxx", pbool ) );
|
||||
assertEquals( pint.intValue() , params.getInt( "xxx", pint ) );
|
||||
assertEquals( pfloat.floatValue() , params.getFloat( "xxx", pfloat ) );
|
||||
assertEquals( pfloat.floatValue() , params.getFloat( "xxx", pfloat ), 0.1);
|
||||
assertEquals( pbool.booleanValue() , params.getFieldBool( "xxx", "bool", pbool ) );
|
||||
assertEquals( pint.intValue() , params.getFieldInt( "xxx", "int", pint ) );
|
||||
assertEquals( pfloat.floatValue() , params.getFieldFloat("xxx", "float", pfloat ) );
|
||||
assertEquals( pfloat.floatValue() , params.getFieldFloat("xxx", "float", pfloat ), 0.1);
|
||||
assertEquals( pstr , params.getFieldParam("xxx", "str", pstr ) );
|
||||
|
||||
// Required params testing uses decorator
|
||||
|
|
Loading…
Reference in New Issue