Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class ToParentBlockJoinCollector

    Collects parent document hits for a Lucene.Net.Search.Query containing one more more BlockJoinQuery clauses, sorted by the specified parent Lucene.Net.Search.Sort. Note that this cannot perform arbitrary joins; rather, it requires that all joined documents are indexed as a doc block (using AddDocuments(IEnumerable<IEnumerable<IIndexableField>>, Analyzer) or UpdateDocuments(Term, IEnumerable<IEnumerable<IIndexableField>>, Analyzer). Ie, the join is computed at index time.

    The parent Lucene.Net.Search.Sort must only use fields from the parent documents; sorting by field in the child documents is not supported.

    You should only use this collector if one or more of the clauses in the query is a ToParentBlockJoinQuery. This collector will find those query clauses and record the matching child documents for the top scoring parent documents.

    Multiple joins (star join) and nested joins and a mix of the two are allowed, as long as in all cases the documents corresponding to a single row of each joined parent table were indexed as a doc block.

    For the simple star join you can retrieve the Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> instance containing each ToParentBlockJoinQuery's matching child documents for the top parent groups, using GetTopGroups(ToParentBlockJoinQuery, Sort, Int32, Int32, Int32, Boolean). Ie, a single query, which will contain two or more ToParentBlockJoinQuery's as clauses representing the star join, can then retrieve two or more Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> instances.

    For nested joins, the query will run correctly (ie, match the right parent and child documents), however, because Lucene.Net.Search.Grouping.TopGroups<TGroupValue> is currently unable to support nesting (each group is not able to hold another Lucene.Net.Search.Grouping.TopGroups<TGroupValue>), you are only able to retrieve the Lucene.Net.Search.Grouping.TopGroups<TGroupValue> of the first join. The Lucene.Net.Search.Grouping.TopGroups<TGroupValue> of the nested joins will not be correct.

    See http://lucene.apache.org/core/4_8_0/join/ for a code sample.

    Note

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

    Inheritance
    System.Object
    ToParentBlockJoinCollector
    Implements
    Lucene.Net.Search.ICollector
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Search.Join
    Assembly: Lucene.Net.Join.dll
    Syntax
    public class ToParentBlockJoinCollector : ICollector

    Constructors

    | Improve this Doc View Source

    ToParentBlockJoinCollector(Sort, Int32, Boolean, Boolean)

    Creates a ToParentBlockJoinCollector. The provided sort must not be null. If you pass true trackScores, all ToParentBlockQuery instances must not use None.

    Declaration
    public ToParentBlockJoinCollector(Sort sort, int numParentHits, bool trackScores, bool trackMaxScore)
    Parameters
    Type Name Description
    Lucene.Net.Search.Sort sort
    System.Int32 numParentHits
    System.Boolean trackScores
    System.Boolean trackMaxScore

    Properties

    | Improve this Doc View Source

    AcceptsDocsOutOfOrder

    Declaration
    public virtual bool AcceptsDocsOutOfOrder { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    MaxScore

    Returns the highest score across all collected parent hits, as long as trackMaxScores=true was passed ToParentBlockJoinCollector(Sort, Int32, Boolean, Boolean) on construction. Else, this returns System.Single.NaN.

    Declaration
    public virtual float MaxScore { get; }
    Property Value
    Type Description
    System.Single

    Methods

    | Improve this Doc View Source

    Collect(Int32)

    Declaration
    public virtual void Collect(int parentDoc)
    Parameters
    Type Name Description
    System.Int32 parentDoc
    | Improve this Doc View Source

    GetTopGroups(ToParentBlockJoinQuery, Sort, Int32, Int32, Int32, Boolean)

    Returns the Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> for the specified BlockJoinQuery. The groupValue of each GroupDocs will be the parent docID for that group. The number of documents within each group is calculated as minimum of maxDocsPerGroup and number of matched child documents for that group. Returns null if no groups matched.

    Declaration
    public virtual ITopGroups<int> GetTopGroups(ToParentBlockJoinQuery query, Sort withinGroupSort, int offset, int maxDocsPerGroup, int withinGroupOffset, bool fillSortFields)
    Parameters
    Type Name Description
    ToParentBlockJoinQuery query

    Search query

    Lucene.Net.Search.Sort withinGroupSort

    Sort criteria within groups

    System.Int32 offset

    Parent docs offset

    System.Int32 maxDocsPerGroup

    Upper bound of documents per group number

    System.Int32 withinGroupOffset

    Offset within each group of child docs

    System.Boolean fillSortFields

    Specifies whether to add sort fields or not

    Returns
    Type Description
    Lucene.Net.Search.Grouping.ITopGroups<System.Int32>

    Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> for specified query

    Exceptions
    Type Condition
    System.IO.IOException

    if there is a low-level I/O error

    | Improve this Doc View Source

    GetTopGroupsWithAllChildDocs(ToParentBlockJoinQuery, Sort, Int32, Int32, Boolean)

    Returns the Lucene.Net.Search.Grouping.TopGroups<TGroupValue> for the specified BlockJoinQuery. The groupValue of each GroupDocs will be the parent docID for that group. The number of documents within each group equals to the total number of matched child documents for that group. Returns null if no groups matched.

    Declaration
    public virtual ITopGroups<int> GetTopGroupsWithAllChildDocs(ToParentBlockJoinQuery query, Sort withinGroupSort, int offset, int withinGroupOffset, bool fillSortFields)
    Parameters
    Type Name Description
    ToParentBlockJoinQuery query

    Search query

    Lucene.Net.Search.Sort withinGroupSort

    Sort criteria within groups

    System.Int32 offset

    Parent docs offset

    System.Int32 withinGroupOffset

    Offset within each group of child docs

    System.Boolean fillSortFields

    Specifies whether to add sort fields or not

    Returns
    Type Description
    Lucene.Net.Search.Grouping.ITopGroups<System.Int32>

    Lucene.Net.Search.Grouping.ITopGroups<TGroupValue> for specified query

    Exceptions
    Type Condition
    System.IO.IOException

    if there is a low-level I/O error

    | Improve this Doc View Source

    SetNextReader(AtomicReaderContext)

    Declaration
    public virtual void SetNextReader(AtomicReaderContext context)
    Parameters
    Type Name Description
    Lucene.Net.Index.AtomicReaderContext context
    | Improve this Doc View Source

    SetScorer(Scorer)

    Declaration
    public virtual void SetScorer(Scorer scorer)
    Parameters
    Type Name Description
    Lucene.Net.Search.Scorer scorer

    Implements

    Lucene.Net.Search.ICollector
    • Improve this Doc
    • View Source
    Back to top Copyright © 2022 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.