CheckHits

object CheckHits

Utility class for asserting expected hits in tests.

Types

Link copied to clipboard
class ExplanationAsserter(var q: Query, defaultFieldName: String?, var s: IndexSearcher, deep: Boolean = false) : SimpleCollector

Asserts that the score explanation for every document matching a query corresponds with the true score.

Link copied to clipboard

an IndexSearcher that implicitly checks hte explanation of every match whenever it executes a search.

Link copied to clipboard

Asserts that the Matches from a query is non-null whenever the document its created for is a hit.

Link copied to clipboard

Just collects document ids into a set.

Functions

Link copied to clipboard
fun checkDocIds(mes: String, results: IntArray, hits: Array<ScoreDoc>)

Tests that a Hits has an expected order of documents

Link copied to clipboard
fun checkEqual(query: Query, hits1: Array<ScoreDoc>, hits2: Array<ScoreDoc>)
Link copied to clipboard
fun checkExplanations(query: Query, defaultFieldName: String?, searcher: IndexSearcher, deep: Boolean = false)

Asserts that the explanation value for every document matching a query corresponds with the true score.

Link copied to clipboard
fun checkHitCollector(random: Random, query: Query, defaultFieldName: String, searcher: IndexSearcher, results: IntArray)

Tests that a query matches the an expected set of documents using a HitCollector.

Link copied to clipboard
fun checkHits(random: Random, query: Query, defaultFieldName: String, searcher: IndexSearcher, results: IntArray)

Tests that a query matches the expected set of documents using Hits.

Link copied to clipboard
fun checkHitsQuery(query: Query, hits1: Array<ScoreDoc>, hits2: Array<ScoreDoc>, results: IntArray)

Tests that two queries have an expected order of documents, and that the two queries have the same score values.

Link copied to clipboard
fun checkMatches(query: Query, searcher: IndexSearcher)

Asserts that the result of calling Weight.matches for every document matching a query returns a non-null Matches

Link copied to clipboard
fun checkNoMatchExplanations(q: Query, defaultFieldName: String, searcher: IndexSearcher, results: IntArray)

Tests that all documents up to maxDoc which are not in the expected result set, have an explanation which indicates that the document does not match

Link copied to clipboard
fun checkTopScores(random: Random, query: Query, searcher: IndexSearcher)
Link copied to clipboard
fun hits2str(hits1: Array<ScoreDoc>, hits2: Array<ScoreDoc>, start: Int, end: Int): String
Link copied to clipboard
fun topdocsString(docs: TopDocs, start: Int, end: Int): String
Link copied to clipboard
fun verifyExplanation(q: String, doc: Int, score: Float, deep: Boolean, expl: Explanation)

Assert that an explanation has the expected score, and optionally that its sub-details max/sum/factor match to that score.