mirror of https://github.com/apache/lucene.git
reset useScorer14 in finally in case of test failure
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@331111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bfe4a24053
commit
9cee714143
|
@ -68,6 +68,7 @@ public class TestBoolean2 extends TestCase {
|
||||||
public void queriesTest(String queryText, int[] expDocNrs) throws Exception {
|
public void queriesTest(String queryText, int[] expDocNrs) throws Exception {
|
||||||
//System.out.println();
|
//System.out.println();
|
||||||
//System.out.println("Query: " + queryText);
|
//System.out.println("Query: " + queryText);
|
||||||
|
try {
|
||||||
Query query1 = makeQuery(queryText);
|
Query query1 = makeQuery(queryText);
|
||||||
BooleanQuery.setUseScorer14(true);
|
BooleanQuery.setUseScorer14(true);
|
||||||
Hits hits1 = searcher.search(query1);
|
Hits hits1 = searcher.search(query1);
|
||||||
|
@ -77,6 +78,9 @@ public class TestBoolean2 extends TestCase {
|
||||||
Hits hits2 = searcher.search(query2);
|
Hits hits2 = searcher.search(query2);
|
||||||
|
|
||||||
CheckHits.checkHitsQuery(query2, hits1, hits2, expDocNrs);
|
CheckHits.checkHitsQuery(query2, hits1, hits2, expDocNrs);
|
||||||
|
} finally { // even when a test fails.
|
||||||
|
BooleanQuery.setUseScorer14(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testQueries01() throws Exception {
|
public void testQueries01() throws Exception {
|
||||||
|
@ -150,6 +154,9 @@ public class TestBoolean2 extends TestCase {
|
||||||
String[] vals = {"w1","w2","w3","w4","w5","xx","yy","zzz"};
|
String[] vals = {"w1","w2","w3","w4","w5","xx","yy","zzz"};
|
||||||
|
|
||||||
int tot=0;
|
int tot=0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
// increase number of iterations for more complete testing
|
// increase number of iterations for more complete testing
|
||||||
for (int i=0; i<1000; i++) {
|
for (int i=0; i<1000; i++) {
|
||||||
int level = rnd.nextInt(3);
|
int level = rnd.nextInt(3);
|
||||||
|
@ -169,6 +176,11 @@ public class TestBoolean2 extends TestCase {
|
||||||
tot+=hits2.length();
|
tot+=hits2.length();
|
||||||
CheckHits.checkEqual(q1, hits1, hits2);
|
CheckHits.checkEqual(q1, hits1, hits2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} finally { // even when a test fails.
|
||||||
|
BooleanQuery.setUseScorer14(false);
|
||||||
|
}
|
||||||
|
|
||||||
// System.out.println("Total hits:"+tot);
|
// System.out.println("Total hits:"+tot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue