Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class TermDistinctValuesCollector

    A term based implementation of AbstractDistinctValuesCollector{TermDistinctValuesCollector.GroupCount} that relies on Lucene.Net.Index.SortedDocValues to count the distinct values per group.

    Note

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

    Inheritance
    object
    AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>
    TermDistinctValuesCollector
    Implements
    IAbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>
    ICollector
    Inherited Members
    AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>.AcceptsDocsOutOfOrder
    AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>.SetScorer(Scorer)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search.Grouping.Terms
    Assembly: Lucene.Net.Grouping.dll
    Syntax
    public class TermDistinctValuesCollector : AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>, IAbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>, ICollector

    Constructors

    TermDistinctValuesCollector(string, string, IEnumerable<ISearchGroup<BytesRef>>)

    Constructs TermDistinctValuesCollector instance.

    Declaration
    public TermDistinctValuesCollector(string groupField, string countField, IEnumerable<ISearchGroup<BytesRef>> groups)
    Parameters
    Type Name Description
    string groupField

    The field to group by

    string countField

    The field to count distinct values for

    IEnumerable<ISearchGroup<BytesRef>> groups

    The top N groups, collected during the first phase search

    Properties

    Groups

    Returns all unique values for each top N group.

    Declaration
    public override IEnumerable<TermDistinctValuesCollector.GroupCount> Groups { get; }
    Property Value
    Type Description
    IEnumerable<TermDistinctValuesCollector.GroupCount>

    all unique values for each top N group

    Overrides
    AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>.Groups

    Methods

    Collect(int)

    Called once for every document matching a query, with the unbased document number.

    Note: The collection of the current segment can be terminated by throwing a Lucene.Net.Search.CollectionTerminatedException. In this case, the last docs of the current Lucene.Net.Index.AtomicReaderContext will be skipped and Lucene.Net.Search.IndexSearcher will swallow the exception and continue collection with the next leaf.

    Note: this is called in an inner search loop. For good search performance, implementations of this method should not call Doc(int) or Document(int) on every hit. Doing so can slow searches by an order of magnitude or more.
    Declaration
    public override void Collect(int doc)
    Parameters
    Type Name Description
    int doc
    Overrides
    AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>.Collect(int)

    SetNextReader(AtomicReaderContext)

    Called before collecting from each Lucene.Net.Index.AtomicReaderContext. All doc ids in Collect(int) will correspond to Lucene.Net.Index.IndexReaderContext.Reader.

    Add Lucene.Net.Index.AtomicReaderContext.DocBase to the current Lucene.Net.Index.IndexReaderContext.Reader's internal document id to re-base ids in Collect(int).

    Declaration
    public override void SetNextReader(AtomicReaderContext context)
    Parameters
    Type Name Description
    AtomicReaderContext context

    next atomic reader context

    Overrides
    AbstractDistinctValuesCollector<TermDistinctValuesCollector.GroupCount>.SetNextReader(AtomicReaderContext)

    Implements

    IAbstractDistinctValuesCollector<GC>
    Lucene.Net.Search.ICollector
    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.