jpountz commented on code in PR #13021: URL: https://github.com/apache/lucene/pull/13021#discussion_r1455491681
########## lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java: ########## @@ -219,22 +228,48 @@ public void testCreateMoreTermsIndex() throws Exception { new IndexWriterConfig(analyzer).setMergePolicy(mp).setUseCompoundFile(false); IndexWriter writer = new IndexWriter(dir, conf); LineFileDocs docs = new LineFileDocs(new Random(0)); + Field docIdDV = null; + Field titleDVField = null; for (int i = 0; i < 50; i++) { - writer.addDocument(docs.nextDoc()); + Document doc = docs.nextDoc(); + if (docIdDV == null) { + docIdDV = new NumericDocValuesField("docid_intDV", 0); + doc.add(docIdDV); + } Review Comment: Nit: this seems to assume that the `Document` instance that is returned is always the same, which feels a bit fragile. Maybe do a shallow copy of the document all the time? Or use `TestUtil.cloneDocument()`? ########## lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java: ########## @@ -204,11 +204,20 @@ private Path getIndexDir() { } public void testCreateMoreTermsIndex() throws Exception { - Path indexDir = getIndexDir().resolve("moreterms"); Files.deleteIfExists(indexDir); - Directory dir = newFSDirectory(indexDir); + try (Directory dir = newFSDirectory(indexDir)) { + createMoreTermsIndex(dir); + } + } + + public void testCreateMoreTermsIndexInternal() throws Exception { + try (Directory dir = newDirectory()) { + createMoreTermsIndex(dir); + } + } + public void createMoreTermsIndex(Directory dir) throws Exception { Review Comment: nit: it doesn't seem to need to be public? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org