public abstract class FieldComparatorBase
extends org.apache.lucene.search.FieldComparator
FieldComparator
implementations
which are based on values in the form of Comparables
.org.apache.lucene.search.FieldComparator.ByteComparator, org.apache.lucene.search.FieldComparator.DocComparator, org.apache.lucene.search.FieldComparator.DoubleComparator, org.apache.lucene.search.FieldComparator.FloatComparator, org.apache.lucene.search.FieldComparator.IntComparator, org.apache.lucene.search.FieldComparator.LongComparator, org.apache.lucene.search.FieldComparator.NumericComparator<T extends Number>, org.apache.lucene.search.FieldComparator.RelevanceComparator, org.apache.lucene.search.FieldComparator.ShortComparator, org.apache.lucene.search.FieldComparator.StringComparatorLocale, org.apache.lucene.search.FieldComparator.StringOrdValComparator, org.apache.lucene.search.FieldComparator.StringValComparator
Constructor and Description |
---|
FieldComparatorBase() |
Modifier and Type | Method and Description |
---|---|
protected int |
compare(Comparable<?> val1,
Comparable<?> val2)
Compare two values
|
int |
compare(int slot1,
int slot2) |
int |
compareBottom(int doc) |
void |
copy(int slot,
int doc) |
protected abstract Comparable<?> |
getValue(int slot)
Retrieves the value of a given slot
|
void |
setBottom(int slot) |
protected abstract void |
setValue(int slot,
Comparable<?> value)
Puts a value into a given slot
|
protected abstract Comparable<?> |
sortValue(int doc)
Value for a document
|
Comparable<?> |
value(int slot) |
protected abstract Comparable<?> sortValue(int doc)
doc
- id of the documentprotected abstract Comparable<?> getValue(int slot)
slot
- index of the value to retrieveprotected abstract void setValue(int slot, Comparable<?> value)
slot
- index where to put the valuevalue
- the value to put into the given slotpublic int compare(int slot1, int slot2)
compare
in class org.apache.lucene.search.FieldComparator
public int compareBottom(int doc) throws IOException
compareBottom
in class org.apache.lucene.search.FieldComparator
IOException
public void setBottom(int slot)
setBottom
in class org.apache.lucene.search.FieldComparator
protected int compare(Comparable<?> val1, Comparable<?> val2)
val1
- first valueval2
- second valueval1
comes before val2
,
a positive integer if val1
comes after val2
and
0
if val1
and val2
are equal.public void copy(int slot, int doc) throws IOException
copy
in class org.apache.lucene.search.FieldComparator
IOException
public Comparable<?> value(int slot)
value
in class org.apache.lucene.search.FieldComparator
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.