mirror of https://github.com/apache/lucene.git
Remove unnecessary bit conversion for IndexSorter (#13320)
This commit is contained in:
parent
3aa25baac7
commit
37837133c3
|
@ -266,23 +266,16 @@ public interface IndexSorter {
|
||||||
public ComparableProvider[] getComparableProviders(List<? extends LeafReader> readers)
|
public ComparableProvider[] getComparableProviders(List<? extends LeafReader> readers)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ComparableProvider[] providers = new ComparableProvider[readers.size()];
|
ComparableProvider[] providers = new ComparableProvider[readers.size()];
|
||||||
final float missingValue;
|
final int missValueBits = Float.floatToIntBits(missingValue != null ? missingValue : 0.0f);
|
||||||
if (this.missingValue != null) {
|
|
||||||
missingValue = this.missingValue;
|
|
||||||
} else {
|
|
||||||
missingValue = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int readerIndex = 0; readerIndex < readers.size(); readerIndex++) {
|
for (int readerIndex = 0; readerIndex < readers.size(); readerIndex++) {
|
||||||
final NumericDocValues values = valuesProvider.get(readers.get(readerIndex));
|
final NumericDocValues values = valuesProvider.get(readers.get(readerIndex));
|
||||||
|
|
||||||
providers[readerIndex] =
|
providers[readerIndex] =
|
||||||
docID -> {
|
docID -> {
|
||||||
float value = missingValue;
|
final int valueBits =
|
||||||
if (values.advanceExact(docID)) {
|
values.advanceExact(docID) ? (int) values.longValue() : missValueBits;
|
||||||
value = Float.intBitsToFloat((int) values.longValue());
|
return NumericUtils.sortableFloatBits(valueBits);
|
||||||
}
|
|
||||||
return NumericUtils.floatToSortableInt(value);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return providers;
|
return providers;
|
||||||
|
@ -336,23 +329,17 @@ public interface IndexSorter {
|
||||||
public ComparableProvider[] getComparableProviders(List<? extends LeafReader> readers)
|
public ComparableProvider[] getComparableProviders(List<? extends LeafReader> readers)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ComparableProvider[] providers = new ComparableProvider[readers.size()];
|
ComparableProvider[] providers = new ComparableProvider[readers.size()];
|
||||||
final double missingValue;
|
final long missingValueBits =
|
||||||
if (this.missingValue != null) {
|
Double.doubleToLongBits(missingValue != null ? missingValue : 0.0f);
|
||||||
missingValue = this.missingValue;
|
|
||||||
} else {
|
|
||||||
missingValue = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int readerIndex = 0; readerIndex < readers.size(); readerIndex++) {
|
for (int readerIndex = 0; readerIndex < readers.size(); readerIndex++) {
|
||||||
final NumericDocValues values = valuesProvider.get(readers.get(readerIndex));
|
final NumericDocValues values = valuesProvider.get(readers.get(readerIndex));
|
||||||
|
|
||||||
providers[readerIndex] =
|
providers[readerIndex] =
|
||||||
docID -> {
|
docID -> {
|
||||||
double value = missingValue;
|
final long valueBits =
|
||||||
if (values.advanceExact(docID)) {
|
values.advanceExact(docID) ? values.longValue() : missingValueBits;
|
||||||
value = Double.longBitsToDouble(values.longValue());
|
return NumericUtils.sortableDoubleBits(valueBits);
|
||||||
}
|
|
||||||
return NumericUtils.doubleToSortableLong(value);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return providers;
|
return providers;
|
||||||
|
|
Loading…
Reference in New Issue