Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SortedTermFreqEnumeratorWrapper

    This wrapper buffers incoming elements and makes sure they are sorted based on given comparer.

    Note

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

    Inheritance
    object
    SortedTermFreqEnumeratorWrapper
    Implements
    ITermFreqEnumerator
    IBytesRefEnumerator
    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.Suggest
    Assembly: Lucene.Net.Suggest.dll
    Syntax
    public class SortedTermFreqEnumeratorWrapper : ITermFreqEnumerator, IBytesRefEnumerator

    Constructors

    SortedTermFreqEnumeratorWrapper(ITermFreqEnumerator)

    Creates a new sorted wrapper, using Lucene.Net.Util.BytesRef.UTF8SortedAsUnicodeComparer for sorting.

    Declaration
    public SortedTermFreqEnumeratorWrapper(ITermFreqEnumerator source)
    Parameters
    Type Name Description
    ITermFreqEnumerator source

    SortedTermFreqEnumeratorWrapper(ITermFreqEnumerator, IComparer<BytesRef>)

    Creates a new sorted wrapper, sorting by BytesRef (ascending) then cost (ascending).

    Declaration
    public SortedTermFreqEnumeratorWrapper(ITermFreqEnumerator source, IComparer<BytesRef> comparer)
    Parameters
    Type Name Description
    ITermFreqEnumerator source
    IComparer<BytesRef> comparer

    Properties

    Comparer

    Return the Lucene.Net.Util.BytesRef Comparer used to sort terms provided by the iterator. This may return null if there are no items or the iterator is not sorted. Callers may invoke this method many times, so it's best to cache a single instance & reuse it.

    Declaration
    public virtual IComparer<BytesRef> Comparer { get; }
    Property Value
    Type Description
    IComparer<BytesRef>

    Current

    Gets the Lucene.Net.Util.BytesRef for the current iteration. The returned Lucene.Net.Util.BytesRef may be reused across calls to Lucene.Net.Util.IBytesRefEnumerator.MoveNext().

    Declaration
    public virtual BytesRef Current { get; }
    Property Value
    Type Description
    BytesRef

    Weight

    Gets the term's weight, higher numbers mean better suggestions.

    Declaration
    public virtual long Weight { get; }
    Property Value
    Type Description
    long

    Methods

    Decode(BytesRef, ByteArrayDataInput)

    decodes the weight at the current position

    Declaration
    protected virtual long Decode(BytesRef scratch, ByteArrayDataInput tmpInput)
    Parameters
    Type Name Description
    BytesRef scratch
    ByteArrayDataInput tmpInput
    Returns
    Type Description
    long

    Encode(ByteSequencesWriter, ByteArrayDataOutput, byte[], BytesRef, long)

    encodes an entry (bytes+weight) to the provided writer

    Declaration
    protected virtual void Encode(OfflineSorter.ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, long weight)
    Parameters
    Type Name Description
    OfflineSorter.ByteSequencesWriter writer
    ByteArrayDataOutput output
    byte[] buffer
    BytesRef spare
    long weight

    MoveNext()

    Increments the iteration to the next Lucene.Net.Util.BytesRef in the enumerator.

    Declaration
    public virtual bool MoveNext()
    Returns
    Type Description
    bool

    true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

    Exceptions
    Type Condition
    IOException

    If there is a low-level I/O error.

    Implements

    ITermFreqEnumerator
    Lucene.Net.Util.IBytesRefEnumerator
    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.