You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2022/05/10 12:15:38 UTC
[lucene] branch branch_9x updated (87df4aa8511 -> 1943833ccb1)
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a change to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
from 87df4aa8511 LUCENE-10532: remove @Slow annotation (#832)
new 1f0ada24a42 LUCENE-10555: avoid NumericLeafComparator#iteratorCost repeated initialization when NumericLeafComparator#setScorer is called (#864)
new 1943833ccb1 fix bkd test logic error and doc error (#863)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
lucene/CHANGES.txt | 3 +++
.../org/apache/lucene/search/comparators/NumericComparator.java | 4 ++--
lucene/core/src/java/org/apache/lucene/util/RadixSelector.java | 2 +-
lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java | 9 +++++++--
4 files changed, 13 insertions(+), 5 deletions(-)
[lucene] 02/02: fix bkd test logic error and doc error (#863)
Posted by jp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 1943833ccb1bd7eccfba3a129d5a9aa2d440d00f
Author: xiaoping <wj...@gmail.com>
AuthorDate: Tue May 10 19:10:00 2022 +0800
fix bkd test logic error and doc error (#863)
---
lucene/core/src/java/org/apache/lucene/util/RadixSelector.java | 2 +-
lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/util/RadixSelector.java b/lucene/core/src/java/org/apache/lucene/util/RadixSelector.java
index 9ef63778642..6a916ed8f85 100644
--- a/lucene/core/src/java/org/apache/lucene/util/RadixSelector.java
+++ b/lucene/core/src/java/org/apache/lucene/util/RadixSelector.java
@@ -56,7 +56,7 @@ public abstract class RadixSelector extends Selector {
/**
* Return the k-th byte of the entry at index {@code i}, or {@code -1} if its length is less than
- * or equal to {@code k}. This may only be called with a value of {@code i} between {@code 0}
+ * or equal to {@code k}. This may only be called with a value of {@code k} between {@code 0}
* included and {@code maxLength} excluded.
*/
protected abstract int byteAt(int i, int k);
diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
index d187f5e9fd0..4552cd97cce 100644
--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
@@ -1674,6 +1674,7 @@ public class TestBKD extends LuceneTestCase {
final int numValues = 10;
final int numBytesPerDim = TestUtil.nextInt(random(), 1, 4);
final byte[][] pointValue = new byte[11][numBytesPerDim];
+ final int[] docId = new int[11];
BKDWriter w =
new BKDWriter(
numValues + 1,
@@ -1684,6 +1685,7 @@ public class TestBKD extends LuceneTestCase {
numValues);
for (int i = 0; i < numValues + 1; i++) {
random().nextBytes(pointValue[i]);
+ docId[i] = i;
}
MutablePointTree val =
new MutablePointTree() {
@@ -1701,7 +1703,7 @@ public class TestBKD extends LuceneTestCase {
@Override
public int getDocID(int i) {
- return i;
+ return docId[i];
}
@Override
@@ -1709,6 +1711,9 @@ public class TestBKD extends LuceneTestCase {
byte[] temp = pointValue[i];
pointValue[i] = pointValue[j];
pointValue[j] = temp;
+ int tempDocId = docId[i];
+ docId[i] = docId[j];
+ docId[j] = tempDocId;
}
@Override
@@ -1729,7 +1734,7 @@ public class TestBKD extends LuceneTestCase {
@Override
public void visitDocValues(IntersectVisitor visitor) throws IOException {
for (int i = 0; i < size(); i++) {
- visitor.visit(i, pointValue[i]);
+ visitor.visit(docId[i], pointValue[i]);
}
}
};
[lucene] 01/02: LUCENE-10555: avoid NumericLeafComparator#iteratorCost repeated initialization when NumericLeafComparator#setScorer is called (#864)
Posted by jp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 1f0ada24a420a0f048a5ec9a6657e6e76890277f
Author: xiaoping <wj...@gmail.com>
AuthorDate: Tue May 10 19:07:41 2022 +0800
LUCENE-10555: avoid NumericLeafComparator#iteratorCost repeated initialization when NumericLeafComparator#setScorer is called (#864)
---
lucene/CHANGES.txt | 3 +++
.../java/org/apache/lucene/search/comparators/NumericComparator.java | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 59e6647e999..1d25ed9d103 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -59,6 +59,9 @@ Improvements
Optimizations
---------------------
+* LUCENE-10555: avoid NumericLeafComparator#iteratorCost repeated initialization
+ when NumericLeafComparator#setScorer is called. (Jianping Weng)
+
* LUCENE-10452: Hunspell: call checkCanceled less frequently to reduce the overhead (Peter Gromov)
* LUCENE-10451: Hunspell: don't perform potentially expensive spellchecking after timeout (Peter Gromov)
diff --git a/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java b/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java
index a44583fceba..ddbf9a1d4ad 100644
--- a/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java
+++ b/lucene/core/src/java/org/apache/lucene/search/comparators/NumericComparator.java
@@ -91,7 +91,7 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
private final byte[] maxValueAsBytes;
private DocIdSetIterator competitiveIterator;
- private long iteratorCost;
+ private long iteratorCost = -1;
private int maxDocVisited = -1;
private int updateCounter = 0;
@@ -165,7 +165,7 @@ public abstract class NumericComparator<T extends Number> extends FieldComparato
@Override
public void setScorer(Scorable scorer) throws IOException {
- if (scorer instanceof Scorer) {
+ if (iteratorCost == -1 && scorer instanceof Scorer) {
iteratorCost =
((Scorer) scorer).iterator().cost(); // starting iterator cost is the scorer's cost
updateCompetitiveIterator(); // update an iterator when we have a new segment