Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class TopDocs

    Represents hits returned by Search(Query, Filter?, int) and Search(Query, int).

    Inheritance
    object
    TopDocs
    TopFieldDocs
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class TopDocs

    Constructors

    TopDocs(int, ScoreDoc[], float)

    Represents hits returned by Search(Query, Filter?, int) and Search(Query, int).

    Declaration
    public TopDocs(int totalHits, ScoreDoc[] scoreDocs, float maxScore)
    Parameters
    Type Name Description
    int totalHits
    ScoreDoc[] scoreDocs
    float maxScore

    Properties

    MaxScore

    Returns the maximum score value encountered. Note that in case scores are not tracked, this returns NaN.

    Declaration
    public virtual float MaxScore { get; set; }
    Property Value
    Type Description
    float

    ScoreDocs

    The top hits for the query.

    Declaration
    public ScoreDoc[] ScoreDocs { get; set; }
    Property Value
    Type Description
    ScoreDoc[]

    TotalHits

    The total number of hits for the query.

    Declaration
    public int TotalHits { get; set; }
    Property Value
    Type Description
    int

    Methods

    Merge(Sort?, int, TopDocs[])

    Returns a new TopDocs, containing topN results across the provided TopDocs, sorting by the specified Sort. Each of the TopDocs must have been sorted by the same Sort, and sort field values must have been filled (ie, fillFields=true must be passed to Create(Sort, int, bool, bool, bool, bool).

    Pass sort=null to merge sort by score descending.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public static TopDocs Merge(Sort? sort, int topN, TopDocs[] shardHits)
    Parameters
    Type Name Description
    Sort sort
    int topN
    TopDocs[] shardHits
    Returns
    Type Description
    TopDocs
    Exceptions
    Type Condition
    ArgumentNullException

    shardHits is null.

    Merge(Sort?, int, int, TopDocs[])

    Same as Merge(Sort?, int, TopDocs[]) but also slices the result at the same time based on the provided start and size. The return TopDocs will always have a scoreDocs with length of at most Count.

    Declaration
    public static TopDocs Merge(Sort? sort, int start, int size, TopDocs[] shardHits)
    Parameters
    Type Name Description
    Sort sort
    int start
    int size
    TopDocs[] shardHits
    Returns
    Type Description
    TopDocs
    Exceptions
    Type Condition
    ArgumentNullException

    shardHits is null.

    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.