mirror of https://github.com/apache/lucene.git
LUCENE-5493: minor cleanups/opto
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5493@1574928 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5483d93556
commit
f39f4f66c1
|
@ -73,7 +73,7 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
|
||||||
final FieldComparator<?> parentComparators[] = new FieldComparator[parentFields.length];
|
final FieldComparator<?> parentComparators[] = new FieldComparator[parentFields.length];
|
||||||
for (int i = 0; i < parentFields.length; i++) {
|
for (int i = 0; i < parentFields.length; i++) {
|
||||||
parentReverseMul[i] = parentFields[i].getReverse() ? -1 : 1;
|
parentReverseMul[i] = parentFields[i].getReverse() ? -1 : 1;
|
||||||
parentComparators[i] = parentFields[i].getComparator(2, i);
|
parentComparators[i] = parentFields[i].getComparator(1, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
SortField childFields[] = childSort.getSort();
|
SortField childFields[] = childSort.getSort();
|
||||||
|
@ -81,7 +81,7 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
|
||||||
final FieldComparator<?> childComparators[] = new FieldComparator[childFields.length];
|
final FieldComparator<?> childComparators[] = new FieldComparator[childFields.length];
|
||||||
for (int i = 0; i < childFields.length; i++) {
|
for (int i = 0; i < childFields.length; i++) {
|
||||||
childReverseMul[i] = childFields[i].getReverse() ? -1 : 1;
|
childReverseMul[i] = childFields[i].getReverse() ? -1 : 1;
|
||||||
childComparators[i] = childFields[i].getComparator(2, i);
|
childComparators[i] = childFields[i].getComparator(1, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: not quite right i guess, really our sort "value" is more complex...
|
// NOTE: not quite right i guess, really our sort "value" is more complex...
|
||||||
|
@ -191,9 +191,11 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
|
||||||
|
|
||||||
int compare(int docID1, int docID2, FieldComparator<?> comparators[], int reverseMul[]) throws IOException {
|
int compare(int docID1, int docID2, FieldComparator<?> comparators[], int reverseMul[]) throws IOException {
|
||||||
for (int i = 0; i < comparators.length; i++) {
|
for (int i = 0; i < comparators.length; i++) {
|
||||||
|
// TODO: would be better if copy() didnt cause a term lookup in TermOrdVal & co,
|
||||||
|
// the segments are always the same here...
|
||||||
comparators[i].copy(0, docID1);
|
comparators[i].copy(0, docID1);
|
||||||
comparators[i].copy(1, docID2);
|
comparators[i].setBottom(0);
|
||||||
int comp = reverseMul[i] * comparators[i].compare(0, 1);
|
int comp = reverseMul[i] * comparators[i].compareBottom(docID2);
|
||||||
if (comp != 0) {
|
if (comp != 0) {
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
@ -203,5 +205,8 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "blockJoin(parentSort=" + parentSort + ",childSort=" + childSort + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class SortSorter extends Sorter {
|
||||||
|
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
reverseMul[i] = fields[i].getReverse() ? -1 : 1;
|
reverseMul[i] = fields[i].getReverse() ? -1 : 1;
|
||||||
comparators[i] = fields[i].getComparator(2, i);
|
comparators[i] = fields[i].getComparator(1, i);
|
||||||
comparators[i].setNextReader(reader.getContext());
|
comparators[i].setNextReader(reader.getContext());
|
||||||
comparators[i].setScorer(FAKESCORER);
|
comparators[i].setScorer(FAKESCORER);
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,11 @@ class SortSorter extends Sorter {
|
||||||
public int compare(int docID1, int docID2) {
|
public int compare(int docID1, int docID2) {
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < comparators.length; i++) {
|
for (int i = 0; i < comparators.length; i++) {
|
||||||
|
// TODO: would be better if copy() didnt cause a term lookup in TermOrdVal & co,
|
||||||
|
// the segments are always the same here...
|
||||||
comparators[i].copy(0, docID1);
|
comparators[i].copy(0, docID1);
|
||||||
comparators[i].copy(1, docID2);
|
comparators[i].setBottom(0);
|
||||||
int comp = reverseMul[i] * comparators[i].compare(0, 1);
|
int comp = reverseMul[i] * comparators[i].compareBottom(docID2);
|
||||||
if (comp != 0) {
|
if (comp != 0) {
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue