C# Class Lucene.Net.Search.CheckHits

Datei anzeigen Open project: apache/lucenenet Class Usage Examples

Public Properties

Property Type Description
EXPLAIN_SCORE_TOLERANCE_DELTA float
EXPLAIN_SCORE_TOLERANCE_MINIMUM float

Public Methods

Method Description
CheckDocIds ( string mes, int results, Lucene.Net.Search.ScoreDoc hits ) : void

Tests that a Hits has an expected order of documents

CheckEqual ( Query query, Lucene.Net.Search.ScoreDoc hits1, Lucene.Net.Search.ScoreDoc hits2 ) : void
CheckExplanations ( Query query, string defaultFieldName, IndexSearcher searcher ) : void

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

CheckExplanations ( Query query, string defaultFieldName, IndexSearcher searcher, bool deep ) : void

Asserts that the explanation value for every document matching a query corresponds with the true score. Optionally does "deep" testing of the explanation details.

CheckHitCollector ( Random random, Query query, string defaultFieldName, IndexSearcher searcher, int results, Similarity similarity ) : void

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

Note that when using the HitCollector API, documents will be collected if they "match" regardless of what their score is.

CheckHitsQuery ( Query query, Lucene.Net.Search.ScoreDoc hits1, Lucene.Net.Search.ScoreDoc hits2, int results ) : void

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

CheckNoMatchExplanations ( Query q, string defaultFieldName, IndexSearcher searcher, int results ) : void

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

DoCheckHits ( Random random, Query query, string defaultFieldName, IndexSearcher searcher, int results, Similarity similarity ) : void

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

Note that when using the Hits API, documents will only be returned if they have a positive normalized score.

ExplainToleranceDelta ( float f1, float f2 ) : float

returns a reasonable epsilon for comparing two floats, where minor differences are acceptable such as score vs. explain

Hits2str ( Lucene.Net.Search.ScoreDoc hits1, Lucene.Net.Search.ScoreDoc hits2, int start, int end ) : string
TopdocsString ( Lucene.Net.Search.TopDocs docs, int start, int end ) : string
VerifyExplanation ( string q, int doc, float score, bool deep, Explanation expl ) : void

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

Method Details

CheckDocIds() public static method

Tests that a Hits has an expected order of documents
public static CheckDocIds ( string mes, int results, Lucene.Net.Search.ScoreDoc hits ) : void
mes string
results int
hits Lucene.Net.Search.ScoreDoc
return void

CheckEqual() public static method

public static CheckEqual ( Query query, Lucene.Net.Search.ScoreDoc hits1, Lucene.Net.Search.ScoreDoc hits2 ) : void
query Query
hits1 Lucene.Net.Search.ScoreDoc
hits2 Lucene.Net.Search.ScoreDoc
return void

CheckExplanations() public static method

Asserts that the explanation value for every document matching a query corresponds with the true score.
public static CheckExplanations ( Query query, string defaultFieldName, IndexSearcher searcher ) : void
query Query the query to test
defaultFieldName string used for displaing the query in assertion messages
searcher IndexSearcher the searcher to test the query against
return void

CheckExplanations() public static method

Asserts that the explanation value for every document matching a query corresponds with the true score. Optionally does "deep" testing of the explanation details.
public static CheckExplanations ( Query query, string defaultFieldName, IndexSearcher searcher, bool deep ) : void
query Query the query to test
defaultFieldName string used for displaing the query in assertion messages
searcher IndexSearcher the searcher to test the query against
deep bool indicates whether a deep comparison of sub-Explanation details should be executed
return void

CheckHitCollector() public static method

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

Note that when using the HitCollector API, documents will be collected if they "match" regardless of what their score is.

public static CheckHitCollector ( Random random, Query query, string defaultFieldName, IndexSearcher searcher, int results, Similarity similarity ) : void
random System.Random
query Query the query to test
defaultFieldName string used for displaying the query in assertion messages
searcher IndexSearcher the searcher to test the query against
results int a list of documentIds that must match the query
similarity Similarity /// LUCENENET specific /// Removes dependency on ///
return void

CheckHitsQuery() public static method

Tests that two queries have an expected order of documents, and that the two queries have the same score values.
public static CheckHitsQuery ( Query query, Lucene.Net.Search.ScoreDoc hits1, Lucene.Net.Search.ScoreDoc hits2, int results ) : void
query Query
hits1 Lucene.Net.Search.ScoreDoc
hits2 Lucene.Net.Search.ScoreDoc
results int
return void

CheckNoMatchExplanations() public static method

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
public static CheckNoMatchExplanations ( Query q, string defaultFieldName, IndexSearcher searcher, int results ) : void
q Query
defaultFieldName string
searcher IndexSearcher
results int
return void

DoCheckHits() public static method

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

Note that when using the Hits API, documents will only be returned if they have a positive normalized score.

public static DoCheckHits ( Random random, Query query, string defaultFieldName, IndexSearcher searcher, int results, Similarity similarity ) : void
random System.Random
query Query the query to test
defaultFieldName string used for displaing the query in assertion messages
searcher IndexSearcher the searcher to test the query against
results int a list of documentIds that must match the query
similarity Similarity /// LUCENENET specific /// Removes dependency on ///
return void

ExplainToleranceDelta() public static method

returns a reasonable epsilon for comparing two floats, where minor differences are acceptable such as score vs. explain
public static ExplainToleranceDelta ( float f1, float f2 ) : float
f1 float
f2 float
return float

Hits2str() public static method

public static Hits2str ( Lucene.Net.Search.ScoreDoc hits1, Lucene.Net.Search.ScoreDoc hits2, int start, int end ) : string
hits1 Lucene.Net.Search.ScoreDoc
hits2 Lucene.Net.Search.ScoreDoc
start int
end int
return string

TopdocsString() public static method

public static TopdocsString ( Lucene.Net.Search.TopDocs docs, int start, int end ) : string
docs Lucene.Net.Search.TopDocs
start int
end int
return string

VerifyExplanation() public static method

Assert that an explanation has the expected score, and optionally that its sub-details max/sum/factor match to that score.
public static VerifyExplanation ( string q, int doc, float score, bool deep, Explanation expl ) : void
q string String representation of the query for assertion messages
doc int Document ID for assertion messages
score float Real score value of doc with query q
deep bool indicates whether a deep comparison of sub-Explanation details should be executed
expl Explanation The Explanation to match against score
return void

Property Details

EXPLAIN_SCORE_TOLERANCE_DELTA public_oe static_oe property

Some explains methods calculate their values though a slightly different order of operations from the actual scoring method ... this allows for a small amount of relative variation
public static float EXPLAIN_SCORE_TOLERANCE_DELTA
return float

EXPLAIN_SCORE_TOLERANCE_MINIMUM public_oe static_oe property

In general we use a relative epsilon, but some tests do crazy things like boost documents with 0, creating tiny tiny scores where the relative difference is large but the absolute difference is tiny. we ensure the the epsilon is always at least this big.
public static float EXPLAIN_SCORE_TOLERANCE_MINIMUM
return float