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 10:09:17 UTC

(lucene) 03/09: Update tests and wire in

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 498c6d28ff0d5ef12f4ce85e169a3fc259838143
Author: Atri Sharma <at...@192.168.1.25>
AuthorDate: Fri Apr 18 01:27:12 2025 +0530

    Update tests and wire in
---
 lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java     | 1 +
 .../org/apache/lucene/codecs/lucene103/Lucene103PostingsFormat.java | 6 ++++--
 .../src/test/org/apache/lucene/search/TestAnytimeRankingNDCG.java   | 4 ++--
 .../org/apache/lucene/search/TestAnytimeRankingRelevanceMatch.java  | 4 ++--
 .../src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java | 4 ++--
 5 files changed, 11 insertions(+), 8 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 ec20137f571..d99353c2b1d 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/BinMapWriter.java
@@ -109,6 +109,7 @@ 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/codecs/lucene103/Lucene103PostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene103/Lucene103PostingsFormat.java
index b463ddc062e..a80b12407b3 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene103/Lucene103PostingsFormat.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene103/Lucene103PostingsFormat.java
@@ -532,7 +532,7 @@ public final class Lucene103PostingsFormat extends PostingsFormat {
           prior = e;
         }
 
-        /*try {
+        try {
           if (prior == null) {
             // Now that all outputs are flushed, perform binning safely
             maybeWriteDocBinning(state);
@@ -544,9 +544,11 @@ public final class Lucene103PostingsFormat extends PostingsFormat {
           } else {
             throw e;
           }
-        }*/
+        }
 
         if (prior != null) {
+          IOUtils.closeWhileHandlingException(ret);
+
           throw prior;
         }
       }
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingNDCG.java b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingNDCG.java
index d7198c1f58d..68bd3663c1d 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingNDCG.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingNDCG.java
@@ -17,7 +17,7 @@
 
 package org.apache.lucene.search;
 
-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;
@@ -41,7 +41,7 @@ public class TestAnytimeRankingNDCG extends LuceneTestCase {
   public void testNDCGDoesNotDiverge() throws Exception {
     MockDirectoryWrapper dir = new MockDirectoryWrapper(random(), new ByteBuffersDirectory());
     IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));
-    iwc.setCodec(new Lucene101Codec());
+    iwc.setCodec(new Lucene103Codec());
 
     FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
     ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceMatch.java b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceMatch.java
index 80d17887f3d..bd5d34b2daa 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceMatch.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingRelevanceMatch.java
@@ -6,7 +6,7 @@
  */
 package org.apache.lucene.search;
 
-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;
@@ -32,7 +32,7 @@ public class TestAnytimeRankingRelevanceMatch extends LuceneTestCase {
   public void testRelevanceMetricsComparison() throws Exception {
     Directory dir = new MMapDirectory(createTempDir("relevance-test"));
     IndexWriterConfig config = new IndexWriterConfig(new MockAnalyzer(random()));
-    config.setCodec(new Lucene101Codec());
+    config.setCodec(new Lucene103Codec());
     config.setUseCompoundFile(false);
     config.setMaxBufferedDocs(100);
 
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 13aaba0a593..13430b78afc 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestAnytimeRankingSearch.java
@@ -19,7 +19,7 @@ package org.apache.lucene.search;
 
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.codecs.Codec;
-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;
@@ -143,7 +143,7 @@ public class TestAnytimeRankingSearch extends LuceneTestCase {
 
   @Test
   public void testSlaCutoffTriggersEarlyTermination() throws Exception {
-    Codec.setDefault(new Lucene101Codec());
+    Codec.setDefault(new Lucene103Codec());
 
     Path indexPath = Files.createTempDirectory("testindex_sla_cutoff");
     try (Directory dir = FSDirectory.open(indexPath);