mirror of https://github.com/apache/lucene.git
LUCENE-2631: fix small perf issues with String/TermOrdValComparator
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@992571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c9af51a92
commit
6ee1ac44ee
|
@ -731,10 +731,7 @@ public abstract class FieldComparator {
|
||||||
@Override
|
@Override
|
||||||
public int compare(int slot1, int slot2) {
|
public int compare(int slot1, int slot2) {
|
||||||
if (readerGen[slot1] == readerGen[slot2]) {
|
if (readerGen[slot1] == readerGen[slot2]) {
|
||||||
int cmp = ords[slot1] - ords[slot2];
|
return ords[slot1] - ords[slot2];
|
||||||
if (cmp != 0) {
|
|
||||||
return cmp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final BytesRef val1 = values[slot1];
|
final BytesRef val1 = values[slot1];
|
||||||
|
@ -786,6 +783,7 @@ public abstract class FieldComparator {
|
||||||
public void copy(int slot, int doc) {
|
public void copy(int slot, int doc) {
|
||||||
final int ord = (int) currentDocToOrd.get(doc);
|
final int ord = (int) currentDocToOrd.get(doc);
|
||||||
if (ord == 0) {
|
if (ord == 0) {
|
||||||
|
ords[slot] = 0;
|
||||||
values[slot] = null;
|
values[slot] = null;
|
||||||
} else {
|
} else {
|
||||||
ords[slot] = ord;
|
ords[slot] = ord;
|
||||||
|
@ -813,11 +811,16 @@ public abstract class FieldComparator {
|
||||||
bottomSlot = bottom;
|
bottomSlot = bottom;
|
||||||
|
|
||||||
bottomValue = values[bottomSlot];
|
bottomValue = values[bottomSlot];
|
||||||
|
if (currentReaderGen == readerGen[bottomSlot]) {
|
||||||
|
bottomOrd = ords[bottomSlot];
|
||||||
|
bottomSameReader = true;
|
||||||
|
} else {
|
||||||
if (bottomValue == null) {
|
if (bottomValue == null) {
|
||||||
// 0 ord is null for all segments
|
// 0 ord is null for all segments
|
||||||
assert ords[bottomSlot] == 0;
|
assert ords[bottomSlot] == 0;
|
||||||
bottomOrd = 0;
|
bottomOrd = 0;
|
||||||
bottomSameReader = true;
|
bottomSameReader = true;
|
||||||
|
readerGen[bottomSlot] = currentReaderGen;
|
||||||
} else {
|
} else {
|
||||||
final int index = binarySearch(tempBR, termsIndex, bottomValue);
|
final int index = binarySearch(tempBR, termsIndex, bottomValue);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
|
@ -830,6 +833,10 @@ public abstract class FieldComparator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bottomSameReader) {
|
||||||
|
readerGen[bottomSlot] = currentReaderGen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Comparable<?> value(int slot) {
|
public Comparable<?> value(int slot) {
|
||||||
|
|
Loading…
Reference in New Issue