fix testcase to only run QueryUtils on a optimized index

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1421793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2012-12-14 10:45:02 +00:00
parent dbd3ce549f
commit 48b1d3a2aa
2 changed files with 11 additions and 3 deletions

View File

@ -257,8 +257,6 @@ public class CommonTermsQuery extends Query {
* Returns true iff {@link Similarity#coord(int,int)} is disabled in scoring
* for the high and low frequency query instance. The top level query will
* always disable coords.
*
* @see #CommonTermsQuery(Occur, Occur, float, boolean)
*/
public boolean isCoordDisabled() {
return disableCoord;

View File

@ -263,7 +263,6 @@ public class CommonTermsQueryTest extends LuceneTestCase {
}
TopDocs cqSearch = searcher.search(cq, reader.maxDoc());
QueryUtils.check(random(), cq, searcher);
TopDocs verifySearch = searcher.search(verifyQuery, reader.maxDoc());
assertEquals(verifySearch.totalHits, cqSearch.totalHits);
@ -277,6 +276,17 @@ public class CommonTermsQueryTest extends LuceneTestCase {
}
assertTrue(hits.isEmpty());
/*
* need to force merge here since QueryUtils adds checks based
* on leave readers which have different statistics than the top
* level reader if we have more than one segment. This could
* result in a different query / results.
*/
w.forceMerge(1);
DirectoryReader reader2 = w.getReader();
QueryUtils.check(random(), cq, newSearcher(reader2));
reader2.close();
} finally {
reader.close();
wrapper.close();