Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class FieldComparer.Int32Comparer

    Parses field's values as int (using GetInt32s(AtomicReader, string, IInt32Parser, bool) and sorts by ascending value

    NOTE: This was IntComparator in Lucene
    Inheritance
    object
    FieldComparer
    FieldComparer<Int32>
    FieldComparer.NumericComparer<Int32>
    FieldComparer.Int32Comparer
    Inherited Members
    FieldComparer<Int32>.SetTopValue<TValue>(TValue)
    FieldComparer<Int32>.GetValue(int)
    FieldComparer<Int32>.CompareValues(Int32, Int32)
    FieldComparer<Int32>.CompareValues(object, object)
    FieldComparer.SetScorer(Scorer)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class FieldComparer.Int32Comparer : FieldComparer.NumericComparer<Int32>

    Properties

    this[int]

    Return the actual value in the slot. LUCENENET NOTE: This was value(int) in Lucene.

    Declaration
    public override Int32 this[int slot] { get; }
    Parameters
    Type Name Description
    int slot

    The value

    Property Value
    Type Description
    Int32

    Value in this slot

    Overrides
    FieldComparer<Int32>.this[int]

    Methods

    Compare(int, int)

    Compare hit at slot1 with hit at slot2.

    Declaration
    public override int Compare(int slot1, int slot2)
    Parameters
    Type Name Description
    int slot1

    first slot to compare

    int slot2

    second slot to compare

    Returns
    Type Description
    int

    any N < 0 if slot2's value is sorted after slot1, any N > 0 if the slot2's value is sorted before slot1 and 0 if they are equal

    Overrides
    FieldComparer<Int32>.Compare(int, int)

    CompareBottom(int)

    Compare the bottom of the queue with this doc. This will only invoked after SetBottom(int) has been called. This should return the same result as Compare(int, int) as if bottom were slot1 and the new document were slot 2.

    For a search that hits many results, this method will be the hotspot (invoked by far the most frequently).

    Declaration
    public override int CompareBottom(int doc)
    Parameters
    Type Name Description
    int doc

    Doc that was hit

    Returns
    Type Description
    int

    Any N < 0 if the doc's value is sorted after the bottom entry (not competitive), any N > 0 if the doc's value is sorted before the bottom entry and 0 if they are equal.

    Overrides
    FieldComparer<Int32>.CompareBottom(int)

    CompareTop(int)

    Compare the top value with this doc. This will only invoked after SetTopValue(T) has been called. This should return the same result as Compare(int, int) as if topValue were slot1 and the new document were slot 2. This is only called for searches that use SearchAfter (deep paging).

    Declaration
    public override int CompareTop(int doc)
    Parameters
    Type Name Description
    int doc

    Doc that was hit

    Returns
    Type Description
    int

    Any N < 0 if the doc's value is sorted after the bottom entry (not competitive), any N > 0 if the doc's value is sorted before the bottom entry and 0 if they are equal.

    Overrides
    FieldComparer<Int32>.CompareTop(int)

    Copy(int, int)

    This method is called when a new hit is competitive. You should copy any state associated with this document that will be required for future comparisons, into the specified slot.

    Declaration
    public override void Copy(int slot, int doc)
    Parameters
    Type Name Description
    int slot

    Which slot to copy the hit to

    int doc

    DocID relative to current reader

    Overrides
    FieldComparer<Int32>.Copy(int, int)

    SetBottom(int)

    Set the bottom slot, ie the "weakest" (sorted last) entry in the queue. When CompareBottom(int) is called, you should compare against this slot. This will always be called before CompareBottom(int).

    Declaration
    public override void SetBottom(int slot)
    Parameters
    Type Name Description
    int slot

    the currently weakest (sorted last) slot in the queue

    Overrides
    FieldComparer<Int32>.SetBottom(int)

    SetNextReader(AtomicReaderContext)

    Set a new AtomicReaderContext. All subsequent docIDs are relative to the current reader (you must add docBase if you need to map it to a top-level docID).

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

    Current reader context

    Returns
    Type Description
    FieldComparer

    The comparer to use for this segment; most comparers can just return "this" to reuse the same comparer across segments

    Overrides
    FieldComparer.NumericComparer<Int32>.SetNextReader(AtomicReaderContext)
    Exceptions
    Type Condition
    IOException

    If there is a low-level IO error

    SetTopValue(Int32)

    Record the top value, for future calls to CompareTop(int). This is only called for searches that use SearchAfter (deep paging), and is called before any calls to SetNextReader(AtomicReaderContext).

    Declaration
    public override void SetTopValue(Int32 value)
    Parameters
    Type Name Description
    Int32 value
    Overrides
    FieldComparer<Int32>.SetTopValue(Int32)
    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.