You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by at...@apache.org on 2025/04/18 11:50:52 UTC
(lucene) branch index_binning_changes updated (cb0b2c38649 -> 7a0394582cb)
This is an automated email from the ASF dual-hosted git repository.
atri pushed a change to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
from cb0b2c38649 Add JMH benchmarks and tidy output
new d9dae667f41 Codec fixes and tidy output
new fe53e1fb5d0 Updates for system out and tidy output
new b57ff7bdb84 output and tidy output
new f4086a97756 Fix closing in tests
new 9c90e24eb79 Add disconnected nodes and tidy output
new 7e925c82038 Update closeable in tests
new 0b5e9794204 Add baseline test
new 05a5ca5ac30 Forbidden api
new 7a0394582cb Update closing in tests
The 9 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:
.../jmh/AnytimeMultiSegmentBenchmark.java | 6 +-
.../jmh/AnytimeQueryLatencyVarianceBenchmark.java | 6 +-
.../benchmark/jmh/AnytimeRankingBenchmark.java | 6 +-
.../jmh/BinningIndexingLatencyBenchmark.java | 48 +++++++-
.../lucene/codecs/ApproximateDocGraphBuilder.java | 4 +
.../org/apache/lucene/codecs/BinMapWriter.java | 1 -
.../org/apache/lucene/codecs/DocGraphBuilder.java | 5 +
.../java/org/apache/lucene/index/BinScoreUtil.java | 16 +++
.../lucene/search/AnytimeRankingCollector.java | 10 --
.../search/TestAnytimeRankingRelevanceSearch.java | 83 ++++++-------
.../lucene/search/TestAnytimeRankingSearch.java | 43 +++----
.../lucene/search/TestBinningRelevanceBoost.java | 132 ---------------------
12 files changed, 138 insertions(+), 222 deletions(-)
delete mode 100644 lucene/core/src/test/org/apache/lucene/search/TestBinningRelevanceBoost.java
(lucene) 07/09: Add baseline test
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 0b5e9794204a18c75c083566ff09f7b87b90bf44
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 16:56:14 2025 +0530
Add baseline test
---
.../jmh/BinningIndexingLatencyBenchmark.java | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
index e9e9640a363..34dd953f657 100644
--- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
+++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
@@ -116,6 +116,50 @@ public class BinningIndexingLatencyBenchmark {
}
}
+ /**
+ * Benchmarks baseline Lucene indexing (no binning, no extra attributes). Used as a strict
+ * baseline against bin-aware indexing modes.
+ */
+ @Benchmark
+ public void indexBatchBaseline() throws IOException {
+ tempDir = Files.createTempDirectory("lucene-baseline-benchmark");
+ try (Directory dir = new MMapDirectory(tempDir)) {
+ IndexWriterConfig config = new IndexWriterConfig(new SingleTokenAnalyzer());
+ config.setCodec(new Lucene103Codec());
+ config.setUseCompoundFile(false);
+
+ try (IndexWriter writer = new IndexWriter(dir, config)) {
+ for (int i = 0; i < docCount; i++) {
+ Document doc = new Document();
+ String content = (i % 200 == 0) ? "lucene relevant content" : "noise filler text " + i;
+ doc.add(new Field("field", content, getBaselineFieldType()));
+ writer.addDocument(doc);
+ }
+ writer.commit();
+ }
+ } finally {
+ Files.walk(tempDir)
+ .sorted(Comparator.reverseOrder())
+ .forEach(
+ path -> {
+ try {
+ Files.deleteIfExists(path);
+ } catch (IOException ignored) {
+ // Best-effort cleanup
+ }
+ });
+ }
+ }
+
+ /** Returns a clean field type with no binning attributes for baseline indexing. */
+ private FieldType getBaselineFieldType() {
+ FieldType baseline = new FieldType(TextField.TYPE_NOT_STORED);
+ baseline.setTokenized(true);
+ baseline.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
+ baseline.freeze();
+ return baseline;
+ }
+
private static final class SingleTokenAnalyzer extends Analyzer {
@Override
protected TokenStreamComponents createComponents(String fieldName) {
(lucene) 06/09: Update closeable in tests
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 7e925c820382bbd6e460acb9784f93d74a44ebcc
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 16:19:48 2025 +0530
Update closeable in tests
---
.../lucene/search/TestAnytimeRankingSearch.java | 43 ++++++++++------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java
index 13867d34baa..cbc008e71c4 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java
@@ -120,31 +120,26 @@ public class TestAnytimeRankingSearch extends LuceneTestCase {
writer.commit();
IndexReader base = DirectoryReader.open(dir);
- IndexReader wrapped = BinScoreUtil.wrap(base);
- try {
- IndexSearcher searcher = newSearcher(wrapped);
- searcher.setSimilarity(new BM25Similarity(2.0f, 0.2f));
- try (AnytimeRankingSearcher anytimeSearcher =
- new AnytimeRankingSearcher(base, 10, 100, "content")) {
-
- ExecutorService exec =
- Executors.newFixedThreadPool(4, new NamedThreadFactory("test-search"));
- List<Future<TopDocs>> futures = new ArrayList<>();
-
- Query query = new TermQuery(new Term("content", "lucene"));
- for (int i = 0; i < 4; i++) {
- futures.add(exec.submit(() -> anytimeSearcher.search(query)));
- }
-
- for (Future<TopDocs> f : futures) {
- TopDocs d = f.get();
- assertNotNull(d);
- assertTrue(d.scoreDocs.length > 0);
- }
- exec.shutdown();
+ IndexSearcher searcher = newSearcher(base);
+ searcher.setSimilarity(new BM25Similarity(2.0f, 0.2f));
+ try (AnytimeRankingSearcher anytimeSearcher =
+ new AnytimeRankingSearcher(base, 10, 100, "content")) {
+
+ ExecutorService exec =
+ Executors.newFixedThreadPool(4, new NamedThreadFactory("test-search"));
+ List<Future<TopDocs>> futures = new ArrayList<>();
+
+ Query query = new TermQuery(new Term("content", "lucene"));
+ for (int i = 0; i < 4; i++) {
+ futures.add(exec.submit(() -> anytimeSearcher.search(query)));
}
- } finally {
- IOUtils.close(base);
+
+ for (Future<TopDocs> f : futures) {
+ TopDocs d = f.get();
+ assertNotNull(d);
+ assertTrue(d.scoreDocs.length > 0);
+ }
+ exec.shutdown();
}
}
}
(lucene) 04/09: Fix closing in tests
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit f4086a97756c7bd443607abf38fd778937fcc48d
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 15:58:17 2025 +0530
Fix closing in tests
---
.../search/TestAnytimeRankingRelevanceSearch.java | 17 ++-
.../lucene/search/TestBinningRelevanceBoost.java | 132 ---------------------
2 files changed, 8 insertions(+), 141 deletions(-)
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java
index ff486a7fd7c..fac52a1b82c 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java
@@ -108,18 +108,17 @@ public class TestAnytimeRankingRelevanceSearch extends LuceneTestCase {
@Test
public void testBM25ScoringDiversity() throws Exception {
- try (DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)))) {
- IndexSearcher searcher = newSearcher(reader);
+ IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)));
+
+ try (AnytimeRankingSearcher anytime = new AnytimeRankingSearcher(reader, 10, 50, "content")) {
+ IndexSearcher searcher = anytime.getSearcher();
searcher.setSimilarity(new BM25Similarity());
- try (AnytimeRankingSearcher anytimeSearcher =
- new AnytimeRankingSearcher(reader, 10, 50, "content")) {
- Query query = new TermQuery(new Term("content", "scoring"));
- TopDocs results = anytimeSearcher.search(query);
+ Query query = new TermQuery(new Term("content", "scoring"));
+ TopDocs results = anytime.search(query);
- assertNotNull("Results should not be null", results);
- assertTrue("Results should be greater than zero", results.scoreDocs.length > 0);
- }
+ assertNotNull("Results should not be null", results);
+ assertTrue("Results should be greater than zero", results.scoreDocs.length > 0);
}
}
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestBinningRelevanceBoost.java b/lucene/core/src/test/org/apache/lucene/search/TestBinningRelevanceBoost.java
deleted file mode 100644
index cd975f934e5..00000000000
--- a/lucene/core/src/test/org/apache/lucene/search/TestBinningRelevanceBoost.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.lucene.search;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.FieldType;
-import org.apache.lucene.document.StoredField;
-import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.IndexOptions;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.similarities.BM25Similarity;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.tests.index.RandomIndexWriter;
-import org.apache.lucene.tests.util.LuceneTestCase;
-import org.apache.lucene.tests.util.TestUtil;
-
-public class TestBinningRelevanceBoost extends LuceneTestCase {
-
- public void testBinningImprovesRecallUnderTruncation() throws Exception {
- final int totalDocs = 5000;
- final int relevantEvery = 200;
- final int truncationLimit = 20;
-
- Directory dir = newDirectory();
- IndexWriterConfig iwc = newIndexWriterConfig();
- iwc.setCodec(TestUtil.getDefaultCodec());
- iwc.setMaxBufferedDocs(100);
- iwc.setUseCompoundFile(false);
-
- FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
- ft.setTokenized(true);
- ft.putAttribute("postingsFormat", "Lucene101");
- ft.putAttribute("doBinning", "true");
- ft.putAttribute("bin.count", "4");
- ft.freeze();
-
- try (RandomIndexWriter writer = new RandomIndexWriter(random(), dir, iwc)) {
- for (int i = 0; i < totalDocs; i++) {
- Document doc = new Document();
- String content =
- (i % relevantEvery == 0) ? "lucene highly relevant text" : "noise filler irrelevant";
- doc.add(new StoredField("docID", i));
- doc.add(new Field("content", content, ft));
- writer.addDocument(doc);
- }
- writer.commit();
- }
-
- IndexReader reader = DirectoryReader.open(dir);
- IndexSearcher baseline = newSearcher(reader);
- baseline.setSimilarity(new BM25Similarity());
-
- try (AnytimeRankingSearcher anytimeRankingSearcher =
- new AnytimeRankingSearcher(reader, 10, truncationLimit, "content")) {
-
- TermQuery query = new TermQuery(new Term("content", "lucene"));
-
- AtomicInteger baselineHits = new AtomicInteger();
- baseline.search(
- query,
- new CollectorManager<SimpleCollector, Void>() {
- @Override
- public SimpleCollector newCollector() {
- return new SimpleCollector() {
- private int seen = 0;
-
- @Override
- public void collect(int doc) throws IOException {
- if (doc % relevantEvery == 0) {
- baselineHits.incrementAndGet();
- }
- if (++seen >= truncationLimit) {
- throw new CollectionTerminatedException();
- }
- }
-
- @Override
- public void doSetNextReader(LeafReaderContext context) {}
-
- @Override
- public ScoreMode scoreMode() {
- return ScoreMode.COMPLETE_NO_SCORES;
- }
- };
- }
-
- @Override
- public Void reduce(Collection<SimpleCollector> collectors) {
- return null;
- }
- });
-
- TopDocs anytimeRankingResults = anytimeRankingSearcher.search(query);
- int anytimeRankingHits = 0;
- for (ScoreDoc sd : anytimeRankingResults.scoreDocs) {
- if (sd.doc % relevantEvery == 0) {
- anytimeRankingHits++;
- }
- }
-
- assertTrue(
- "ARCANE hits=" + anytimeRankingHits + " baseline=" + baselineHits,
- anytimeRankingHits >= baselineHits.get() - 1); // allow small variance
-
- reader.close();
- dir.close();
- }
- }
-}
(lucene) 05/09: Add disconnected nodes and tidy output
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 9c90e24eb79e3be219868903ac80f90a4adf7aff
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 16:15:26 2025 +0530
Add disconnected nodes and tidy output
---
.../java/org/apache/lucene/codecs/ApproximateDocGraphBuilder.java | 4 ++++
lucene/core/src/java/org/apache/lucene/codecs/DocGraphBuilder.java | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/ApproximateDocGraphBuilder.java b/lucene/core/src/java/org/apache/lucene/codecs/ApproximateDocGraphBuilder.java
index 93e2b82f9b3..1235057010e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/ApproximateDocGraphBuilder.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/ApproximateDocGraphBuilder.java
@@ -133,6 +133,10 @@ public final class ApproximateDocGraphBuilder {
}
}
+ // Ensure all documents are represented in the graph, even if they have no edges
+ for (int docID = 0; docID < reader.maxDoc(); docID++) {
+ graph.ensureVertex(docID);
+ }
return graph;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/DocGraphBuilder.java b/lucene/core/src/java/org/apache/lucene/codecs/DocGraphBuilder.java
index aa499a7d549..729e680d731 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/DocGraphBuilder.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/DocGraphBuilder.java
@@ -116,6 +116,11 @@ public final class DocGraphBuilder {
}
}
+ // Ensure all documents are represented in the graph, even if they have no edges
+ for (int docID = 0; docID < reader.maxDoc(); docID++) {
+ graph.ensureVertex(docID);
+ }
+
return graph;
}
(lucene) 09/09: Update closing in tests
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 7a0394582cb9f7a9f612bfe3b575f340fbe917fd
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 17:05:58 2025 +0530
Update closing in tests
---
.../search/TestAnytimeRankingRelevanceSearch.java | 66 ++++++++++------------
1 file changed, 31 insertions(+), 35 deletions(-)
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java
index fac52a1b82c..9f8b07e1be2 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceSearch.java
@@ -75,34 +75,32 @@ public class TestAnytimeRankingRelevanceSearch extends LuceneTestCase {
@Test
public void testRelevanceAcrossDiverseDocuments() throws Exception {
- try (DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)))) {
- IndexSearcher searcher = newSearcher(reader);
- searcher.setSimilarity(new BM25Similarity());
+ DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)));
+ IndexSearcher searcher = newSearcher(reader);
+ searcher.setSimilarity(new BM25Similarity());
- Query query = new TermQuery(new Term("content", "lucene"));
- try (AnytimeRankingSearcher anytimeSearcher =
- new AnytimeRankingSearcher(reader, 10, 20, "content")) {
- TopDocs results = anytimeSearcher.search(query);
+ Query query = new TermQuery(new Term("content", "lucene"));
+ try (AnytimeRankingSearcher anytimeSearcher =
+ new AnytimeRankingSearcher(reader, 10, 20, "content")) {
+ TopDocs results = anytimeSearcher.search(query);
- assertNotNull("Results should not be null", results);
- assertTrue("Results should be greater than zero", results.scoreDocs.length > 0);
- }
+ assertNotNull("Results should not be null", results);
+ assertTrue("Results should be greater than zero", results.scoreDocs.length > 0);
}
}
public void testPerformanceQueries() throws Exception {
- try (DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)))) {
- IndexSearcher searcher = newSearcher(reader);
- searcher.setSimilarity(new BM25Similarity());
+ DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)));
+ IndexSearcher searcher = newSearcher(reader);
+ searcher.setSimilarity(new BM25Similarity());
- try (AnytimeRankingSearcher anytimeSearcher =
- new AnytimeRankingSearcher(reader, 15, 30, "content")) {
- Query query = new TermQuery(new Term("content", "performance"));
- TopDocs results = anytimeSearcher.search(query);
+ try (AnytimeRankingSearcher anytimeSearcher =
+ new AnytimeRankingSearcher(reader, 15, 30, "content")) {
+ Query query = new TermQuery(new Term("content", "performance"));
+ TopDocs results = anytimeSearcher.search(query);
- assertNotNull("Results should not be null", results);
- assertTrue("Results should be greater than zero", results.scoreDocs.length > 0);
- }
+ assertNotNull("Results should not be null", results);
+ assertTrue("Results should be greater than zero", results.scoreDocs.length > 0);
}
}
@@ -124,18 +122,17 @@ public class TestAnytimeRankingRelevanceSearch extends LuceneTestCase {
@Test
public void testEmptyQuery() throws Exception {
- try (DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)))) {
- IndexSearcher searcher = newSearcher(reader);
- searcher.setSimilarity(new BM25Similarity());
+ DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)));
+ IndexSearcher searcher = newSearcher(reader);
+ searcher.setSimilarity(new BM25Similarity());
- try (AnytimeRankingSearcher anytimeSearcher =
- new AnytimeRankingSearcher(reader, 5, 20, "content")) {
- Query query = new TermQuery(new Term("content", " "));
- TopDocs results = anytimeSearcher.search(query);
+ try (AnytimeRankingSearcher anytimeSearcher =
+ new AnytimeRankingSearcher(reader, 5, 20, "content")) {
+ Query query = new TermQuery(new Term("content", " "));
+ TopDocs results = anytimeSearcher.search(query);
- assertNotNull("Empty queries should return zero results", results);
- assertEquals("Results should be zero for an empty query", 0, results.scoreDocs.length);
- }
+ assertNotNull("Empty queries should return zero results", results);
+ assertEquals("Results should be zero for an empty query", 0, results.scoreDocs.length);
}
}
@@ -153,11 +150,10 @@ public class TestAnytimeRankingRelevanceSearch extends LuceneTestCase {
writer.commit();
}
- try (DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)))) {
- try (AnytimeRankingSearcher ars = new AnytimeRankingSearcher(reader, 5, 20, "content")) {
- TopDocs results = ars.search(new TermQuery(new Term("content", "lucene")));
- assertTrue(results.scoreDocs.length > 0);
- }
+ DirectoryReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexPath)));
+ try (AnytimeRankingSearcher ars = new AnytimeRankingSearcher(reader, 5, 20, "content")) {
+ TopDocs results = ars.search(new TermQuery(new Term("content", "lucene")));
+ assertTrue(results.scoreDocs.length > 0);
}
}
(lucene) 08/09: Forbidden api
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 05a5ca5ac30ff80f9332cae46f98a3669c485fac
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 16:57:18 2025 +0530
Forbidden api
---
.../apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
index 34dd953f657..fb4ca423ca0 100644
--- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
+++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
@@ -145,7 +145,7 @@ public class BinningIndexingLatencyBenchmark {
try {
Files.deleteIfExists(path);
} catch (IOException ignored) {
- // Best-effort cleanup
+ assert ignored != null;
}
});
}
(lucene) 01/09: Codec fixes and tidy output
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit d9dae667f414db2be26600986ee234187c976227
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 15:42:29 2025 +0530
Codec fixes and tidy output
---
.../apache/lucene/benchmark/jmh/AnytimeMultiSegmentBenchmark.java | 6 +++---
.../lucene/benchmark/jmh/AnytimeQueryLatencyVarianceBenchmark.java | 6 +++---
.../org/apache/lucene/benchmark/jmh/AnytimeRankingBenchmark.java | 6 +++---
.../lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeMultiSegmentBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeMultiSegmentBenchmark.java
index d79683f4c14..82daf8dc037 100644
--- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeMultiSegmentBenchmark.java
+++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeMultiSegmentBenchmark.java
@@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.codecs.lucene101.Lucene101Codec;
+import org.apache.lucene.codecs.lucene103.Lucene103Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@@ -80,7 +80,7 @@ public class AnytimeMultiSegmentBenchmark {
Path path = Files.createTempDirectory("benchmark-segments");
dir = new MMapDirectory(path);
IndexWriterConfig iwc = new IndexWriterConfig(new FixedTokenAnalyzer());
- iwc.setCodec(new Lucene101Codec());
+ iwc.setCodec(new Lucene103Codec());
iwc.setUseCompoundFile(false);
iwc.setMaxBufferedDocs(50); // force multiple flushes
@@ -108,7 +108,7 @@ public class AnytimeMultiSegmentBenchmark {
searcher = new IndexSearcher(reader);
searcher.setSimilarity(new BM25Similarity());
- anytimeSearcher = new AnytimeRankingSearcher(searcher, 10, 5, "field");
+ anytimeSearcher = new AnytimeRankingSearcher(reader, 10, 5, "field");
query = new TermQuery(new Term("field", "lucene"));
}
diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeQueryLatencyVarianceBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeQueryLatencyVarianceBenchmark.java
index 1a90fe85952..ea093f9f59e 100644
--- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeQueryLatencyVarianceBenchmark.java
+++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeQueryLatencyVarianceBenchmark.java
@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.codecs.lucene101.Lucene101Codec;
+import org.apache.lucene.codecs.lucene103.Lucene103Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@@ -80,7 +80,7 @@ public class AnytimeQueryLatencyVarianceBenchmark {
Path tempDir = Files.createTempDirectory("query-latency-variance");
directory = new MMapDirectory(tempDir);
IndexWriterConfig config = new IndexWriterConfig(new SingleTokenAnalyzer());
- config.setCodec(new Lucene101Codec());
+ config.setCodec(new Lucene103Codec());
config.setUseCompoundFile(false);
config.setMaxBufferedDocs(64);
@@ -107,7 +107,7 @@ public class AnytimeQueryLatencyVarianceBenchmark {
baselineSearcher = new IndexSearcher(reader);
baselineSearcher.setSimilarity(new BM25Similarity());
- anytimeSearcher = new AnytimeRankingSearcher(baselineSearcher, 10, 5, "field");
+ anytimeSearcher = new AnytimeRankingSearcher(reader, 10, 5, "field");
query = new TermQuery(new Term("field", "lucene"));
}
diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeRankingBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeRankingBenchmark.java
index bf764226c5b..523979069ff 100644
--- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeRankingBenchmark.java
+++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/AnytimeRankingBenchmark.java
@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.codecs.lucene101.Lucene101Codec;
+import org.apache.lucene.codecs.lucene103.Lucene103Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@@ -80,7 +80,7 @@ public class AnytimeRankingBenchmark {
Path tempDir = Files.createTempDirectory("anytime-benchmark");
directory = new MMapDirectory(tempDir);
IndexWriterConfig config = new IndexWriterConfig(new SingleTokenAnalyzer());
- config.setCodec(new Lucene101Codec());
+ config.setCodec(new Lucene103Codec());
config.setUseCompoundFile(false);
FieldType fieldType = new FieldType(TextField.TYPE_NOT_STORED);
@@ -107,7 +107,7 @@ public class AnytimeRankingBenchmark {
reader = DirectoryReader.open(directory);
baselineSearcher = new IndexSearcher(reader);
baselineSearcher.setSimilarity(new BM25Similarity());
- anytimeSearcher = new AnytimeRankingSearcher(baselineSearcher, 10, 5, "field");
+ anytimeSearcher = new AnytimeRankingSearcher(reader, 10, 5, "field");
query = new TermQuery(new Term("field", "lucene"));
}
diff --git a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
index 852d3ecc4eb..e9e9640a363 100644
--- a/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
+++ b/lucene/benchmark-jmh/src/java/org/apache/lucene/benchmark/jmh/BinningIndexingLatencyBenchmark.java
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.codecs.lucene101.Lucene101Codec;
+import org.apache.lucene.codecs.lucene103.Lucene103Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
@@ -90,7 +90,7 @@ public class BinningIndexingLatencyBenchmark {
tempDir = Files.createTempDirectory("lucene-binning-benchmark");
try (Directory dir = new MMapDirectory(tempDir)) {
IndexWriterConfig config = new IndexWriterConfig(new SingleTokenAnalyzer());
- config.setCodec(new Lucene101Codec());
+ config.setCodec(new Lucene103Codec());
config.setUseCompoundFile(false);
try (IndexWriter writer = new IndexWriter(dir, config)) {
(lucene) 02/09: Updates for system out and tidy output
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit fe53e1fb5d080c30517c1032b2a4341bd19eb209
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 15:44:17 2025 +0530
Updates for system out and tidy output
---
.../core/src/java/org/apache/lucene/codecs/BinMapWriter.java | 1 -
.../java/org/apache/lucene/search/AnytimeRankingCollector.java | 10 ----------
2 files changed, 11 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java
index ebf647c90fa..9b40d438c5e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java
@@ -108,7 +108,6 @@ public final class BinMapWriter implements AutoCloseable {
IOUtils.close(out);
} else {
IOUtils.closeWhileHandlingException(out);
- System.out.println("closing " + fileName);
IOUtils.deleteFilesIgnoringExceptions(directory, fileName);
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/search/AnytimeRankingCollector.java b/lucene/core/src/java/org/apache/lucene/search/AnytimeRankingCollector.java
index 8221a8ed657..86f12b0fafd 100644
--- a/lucene/core/src/java/org/apache/lucene/search/AnytimeRankingCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/AnytimeRankingCollector.java
@@ -17,7 +17,6 @@
package org.apache.lucene.search;
import java.io.IOException;
-import java.util.Locale;
import org.apache.lucene.index.BinScoreLeafReader;
import org.apache.lucene.index.BinScoreReader;
import org.apache.lucene.index.LeafReader;
@@ -106,15 +105,6 @@ public final class AnytimeRankingCollector extends TopDocsCollector<ScoreDoc> {
float finalScore = rawScore * boost;
- System.out.printf(
- Locale.ROOT,
- "doc=%d raw=%.4f boost=%.2f bin=%d final=%.4f%n",
- doc + base,
- rawScore,
- boost,
- bin,
- finalScore);
-
if (finalScore <= 0 || Float.isNaN(finalScore)) {
return;
}
(lucene) 03/09: output and tidy output
Posted by at...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
atri pushed a commit to branch index_binning_changes
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit b57ff7bdb84ee093d6904a01f2c43450c10af494
Author: Atri Sharma <at...@Atris-MacBook-Pro-3.local>
AuthorDate: Fri Apr 18 15:45:57 2025 +0530
output and tidy output
---
.../src/java/org/apache/lucene/index/BinScoreUtil.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lucene/core/src/java/org/apache/lucene/index/BinScoreUtil.java b/lucene/core/src/java/org/apache/lucene/index/BinScoreUtil.java
index 7161ea94d43..6e00a1b7e10 100644
--- a/lucene/core/src/java/org/apache/lucene/index/BinScoreUtil.java
+++ b/lucene/core/src/java/org/apache/lucene/index/BinScoreUtil.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.lucene.index;
import java.io.Closeable;