From f5e8e64d3bf72f46ec4ef102d4a5eeceb064b1c6 Mon Sep 17 00:00:00 2001 From: ChrisHegarty Date: Tue, 5 Dec 2023 12:57:09 +0000 Subject: [PATCH] Upgrade to Lucene 9.9.0 --- pom.xml | 2 +- .../java/io/anserini/index/IndexHnswDenseVectors.java | 8 ++++---- .../java/io/anserini/index/IndexInvertedDenseVectors.java | 4 ++-- .../io/anserini/search/SearchHnswDenseVectorsTest.java | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index bb986658bb..4a011a4731 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ - 9.8.0 + 9.9.0 UTF-8 diff --git a/src/main/java/io/anserini/index/IndexHnswDenseVectors.java b/src/main/java/io/anserini/index/IndexHnswDenseVectors.java index 0dbd80a288..59a4c1ca8f 100644 --- a/src/main/java/io/anserini/index/IndexHnswDenseVectors.java +++ b/src/main/java/io/anserini/index/IndexHnswDenseVectors.java @@ -31,8 +31,8 @@ import org.apache.lucene.codecs.KnnVectorsFormat; import org.apache.lucene.codecs.KnnVectorsReader; import org.apache.lucene.codecs.KnnVectorsWriter; -import org.apache.lucene.codecs.lucene95.Lucene95Codec; -import org.apache.lucene.codecs.lucene95.Lucene95HnswVectorsFormat; +import org.apache.lucene.codecs.lucene99.Lucene99Codec; +import org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat; import org.apache.lucene.index.ConcurrentMergeScheduler; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; @@ -280,11 +280,11 @@ public Counters run() throws IOException { final Directory dir = FSDirectory.open(indexPath); final IndexWriterConfig config = new IndexWriterConfig().setCodec( - new Lucene95Codec() { + new Lucene99Codec() { @Override public KnnVectorsFormat getKnnVectorsFormatForField(String field) { return new OpenAiDelegatingKnnVectorsFormat( - new Lucene95HnswVectorsFormat(args.M, args.efC), 4096); + new Lucene99HnswVectorsFormat(args.M, args.efC), 4096); } }); diff --git a/src/main/java/io/anserini/index/IndexInvertedDenseVectors.java b/src/main/java/io/anserini/index/IndexInvertedDenseVectors.java index 54ed6b560d..068ea5414b 100644 --- a/src/main/java/io/anserini/index/IndexInvertedDenseVectors.java +++ b/src/main/java/io/anserini/index/IndexInvertedDenseVectors.java @@ -33,7 +33,7 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper; import org.apache.lucene.analysis.standard.StandardAnalyzer; -import org.apache.lucene.codecs.lucene95.Lucene95Codec; +import org.apache.lucene.codecs.lucene99.Lucene99Codec; import org.apache.lucene.index.ConcurrentMergeScheduler; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; @@ -278,7 +278,7 @@ public Counters run() throws IOException { Analyzer analyzer = new PerFieldAnalyzerWrapper(new StandardAnalyzer(), map); final Directory dir = FSDirectory.open(indexPath); - final IndexWriterConfig config = new IndexWriterConfig(analyzer).setCodec(new Lucene95Codec()); + final IndexWriterConfig config = new IndexWriterConfig(analyzer).setCodec(new Lucene99Codec()); config.setOpenMode(IndexWriterConfig.OpenMode.CREATE); config.setRAMBufferSizeMB(args.memorybufferSize); config.setUseCompoundFile(false); diff --git a/src/test/java/io/anserini/search/SearchHnswDenseVectorsTest.java b/src/test/java/io/anserini/search/SearchHnswDenseVectorsTest.java index d2f72b65b6..9abb9a5988 100644 --- a/src/test/java/io/anserini/search/SearchHnswDenseVectorsTest.java +++ b/src/test/java/io/anserini/search/SearchHnswDenseVectorsTest.java @@ -306,8 +306,8 @@ public void test1() throws Exception { "160885 Q0 44 2 0.861596 Anserini", "160885 Q0 40 3 0.858651 Anserini", "160885 Q0 48 4 0.858514 Anserini", - "160885 Q0 41 5 0.856264 Anserini", - "867490 Q0 10 1 0.850332 Anserini", + "160885 Q0 41 5 0.856265 Anserini", + "867490 Q0 10 1 0.850331 Anserini", "867490 Q0 45 2 0.846281 Anserini", "867490 Q0 44 3 0.845236 Anserini", "867490 Q0 95 4 0.845013 Anserini",