Package org.apache.lucene.tests.search
Class QueryUtils
java.lang.Object
org.apache.lucene.tests.search.QueryUtils
Utility class for sanity-checking queries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheck(Random random, Query q1, IndexSearcher s) Various query sanity checks on a searcher, some checks are only done for instanceof IndexSearcher.static voidcheck(Random random, Query q1, IndexSearcher s, boolean wrap) static voidCheck the types of things query objects should be able to do.static voidcheckBulkScorerSkipTo(Random r, Query query, IndexSearcher searcher) Check that the scorer and bulk scorer advance consistently.static voidcheckCount(Query query, IndexSearcher searcher) Check that counting hits throughDocIdStream.count()yield the same result as counting naively.static voidcheckEqual(Query q1, Query q2) static voiddeep check that explanations of a query 'score' correctlystatic voidcheck that first skip on just created scorers always goes to the right docstatic voidcheck very basic hashCode and equalsstatic voidcheckSkipTo(Query q, IndexSearcher s) alternate scorer advance(),advance(),next(),next(),advance(),advance(), etc and ensure a hitcollector receives same docs and scoresstatic voidcheckUnequal(Query q1, Query q2) static IndexSearcherwrapUnderlyingReader(Random random, IndexSearcher s, int edge) Given an IndexSearcher, returns a new IndexSearcher whose IndexReader is a MultiReader containing the Reader of the original IndexSearcher, as well as several "empty" IndexReaders -- some of which will have deleted documents in them.
-
Constructor Details
-
QueryUtils
public QueryUtils()
-
-
Method Details
-
check
Check the types of things query objects should be able to do. -
checkHashEquals
check very basic hashCode and equals -
checkEqual
-
checkUnequal
-
checkExplanations
deep check that explanations of a query 'score' correctly- Throws:
IOException
-
check
Various query sanity checks on a searcher, some checks are only done for instanceof IndexSearcher.- See Also:
-
check
-
wrapUnderlyingReader
public static IndexSearcher wrapUnderlyingReader(Random random, IndexSearcher s, int edge) throws IOException Given an IndexSearcher, returns a new IndexSearcher whose IndexReader is a MultiReader containing the Reader of the original IndexSearcher, as well as several "empty" IndexReaders -- some of which will have deleted documents in them. This new IndexSearcher should behave exactly the same as the original IndexSearcher.- Parameters:
s- the searcher to wrapedge- if negative, s will be the first sub; if 0, s will be in the middle, if positive s will be the last sub- Throws:
IOException
-
checkSkipTo
alternate scorer advance(),advance(),next(),next(),advance(),advance(), etc and ensure a hitcollector receives same docs and scores- Throws:
IOException
-
checkFirstSkipTo
check that first skip on just created scorers always goes to the right doc- Throws:
IOException
-
checkBulkScorerSkipTo
public static void checkBulkScorerSkipTo(Random r, Query query, IndexSearcher searcher) throws IOException Check that the scorer and bulk scorer advance consistently.- Throws:
IOException
-
checkCount
Check that counting hits throughDocIdStream.count()yield the same result as counting naively.- Throws:
IOException
-