Show / Hide Table of Contents

    Class CheckHits

    Utility class for asserting expected hits in tests.

    Inheritance
    System.Object
    CheckHits
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.TestFramework.dll
    Syntax
    public static class CheckHits : object

    Fields

    | Improve this Doc View Source

    EXPLAIN_SCORE_TOLERANCE_DELTA

    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

    Declaration
    public static float EXPLAIN_SCORE_TOLERANCE_DELTA
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    EXPLAIN_SCORE_TOLERANCE_MINIMUM

    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.

    Declaration
    public static float EXPLAIN_SCORE_TOLERANCE_MINIMUM
    Field Value
    Type Description
    System.Single

    Methods

    | Improve this Doc View Source

    CheckDocIds(String, Int32[], ScoreDoc[])

    Tests that a Hits has an expected order of documents.

    Declaration
    public static void CheckDocIds(string mes, int[] results, ScoreDoc[] hits)
    Parameters
    Type Name Description
    System.String mes
    System.Int32[] results
    ScoreDoc[] hits
    | Improve this Doc View Source

    CheckEqual(Query, ScoreDoc[], ScoreDoc[])

    Declaration
    public static void CheckEqual(Query query, ScoreDoc[] hits1, ScoreDoc[] hits2)
    Parameters
    Type Name Description
    Query query
    ScoreDoc[] hits1
    ScoreDoc[] hits2
    | Improve this Doc View Source

    CheckExplanations(Query, String, IndexSearcher)

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

    See for a "deep" testing of the explanation details.

    Declaration
    public static void CheckExplanations(Query query, string defaultFieldName, IndexSearcher searcher)
    Parameters
    Type Name Description
    Query query

    The query to test.

    System.String defaultFieldName

    Used for displaing the query in assertion messages.

    IndexSearcher searcher

    The searcher to test the query against.

    See Also
    ExplanationAsserter
    | Improve this Doc View Source

    CheckExplanations(Query, String, IndexSearcher, Boolean)

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

    Declaration
    public static void CheckExplanations(Query query, string defaultFieldName, IndexSearcher searcher, bool deep)
    Parameters
    Type Name Description
    Query query

    The query to test.

    System.String defaultFieldName

    Used for displaing the query in assertion messages.

    IndexSearcher searcher

    The searcher to test the query against.

    System.Boolean deep

    Indicates whether a deep comparison of sub-Explanation details should be executed.

    See Also
    ExplanationAsserter
    | Improve this Doc View Source

    CheckHitCollector(Random, Query, String, IndexSearcher, Int32[])

    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.

    Declaration
    public static void CheckHitCollector(Random random, Query query, string defaultFieldName, IndexSearcher searcher, int[] results)
    Parameters
    Type Name Description
    Random random
    Query query

    The query to test.

    System.String defaultFieldName

    Used for displaying the query in assertion messages.

    IndexSearcher searcher

    The searcher to test the query against.

    System.Int32[] results

    A list of documentIds that must match the query.

    See Also
    DoCheckHits(Random, Query, String, IndexSearcher, Int32[])
    | Improve this Doc View Source

    CheckHitsQuery(Query, ScoreDoc[], ScoreDoc[], Int32[])

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

    Declaration
    public static void CheckHitsQuery(Query query, ScoreDoc[] hits1, ScoreDoc[] hits2, int[] results)
    Parameters
    Type Name Description
    Query query
    ScoreDoc[] hits1
    ScoreDoc[] hits2
    System.Int32[] results
    | Improve this Doc View Source

    CheckNoMatchExplanations(Query, String, IndexSearcher, Int32[])

    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

    Declaration
    public static void CheckNoMatchExplanations(Query q, string defaultFieldName, IndexSearcher searcher, int[] results)
    Parameters
    Type Name Description
    Query q
    System.String defaultFieldName
    IndexSearcher searcher
    System.Int32[] results
    | Improve this Doc View Source

    DoCheckHits(Random, Query, String, IndexSearcher, Int32[])

    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.

    Declaration
    public static void DoCheckHits(Random random, Query query, string defaultFieldName, IndexSearcher searcher, int[] results)
    Parameters
    Type Name Description
    Random random
    Query query

    the query to test

    System.String defaultFieldName

    used for displaing the query in assertion messages

    IndexSearcher searcher

    the searcher to test the query against

    System.Int32[] results

    a list of documentIds that must match the query

    See Also
    CheckHitCollector(Random, Query, String, IndexSearcher, Int32[])
    | Improve this Doc View Source

    ExplainToleranceDelta(Single, Single)

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

    Declaration
    public static float ExplainToleranceDelta(float f1, float f2)
    Parameters
    Type Name Description
    System.Single f1
    System.Single f2
    Returns
    Type Description
    System.Single
    | Improve this Doc View Source

    Hits2str(ScoreDoc[], ScoreDoc[], Int32, Int32)

    Declaration
    public static string Hits2str(ScoreDoc[] hits1, ScoreDoc[] hits2, int start, int end)
    Parameters
    Type Name Description
    ScoreDoc[] hits1
    ScoreDoc[] hits2
    System.Int32 start
    System.Int32 end
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    TopDocsString(TopDocs, Int32, Int32)

    Declaration
    public static string TopDocsString(TopDocs docs, int start, int end)
    Parameters
    Type Name Description
    TopDocs docs
    System.Int32 start
    System.Int32 end
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    VerifyExplanation(String, Int32, Single, Boolean, Explanation)

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

    Declaration
    public static void VerifyExplanation(string q, int doc, float score, bool deep, Explanation expl)
    Parameters
    Type Name Description
    System.String q

    String representation of the query for assertion messages.

    System.Int32 doc

    Document ID for assertion messages.

    System.Single score

    Real score value of doc with query q.

    System.Boolean deep

    Indicates whether a deep comparison of sub-Explanation details should be executed.

    Explanation expl

    The to match against score.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)