stefanvodita commented on code in PR #13028: URL: https://github.com/apache/lucene/pull/13028#discussion_r1462177725
########## lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestTaxonomyIndexArrays.java: ########## @@ -59,4 +64,22 @@ public void testMultiplesOfChunkSize() { ordinal = newOrdinal; } } + + public void testConstructFromEmptyIndex() throws IOException { + Directory dir = newDirectory(); + + // Produce empty index + new IndexWriter(dir, newIndexWriterConfig(null)).close(); + + IndexReader reader = DirectoryReader.open(dir); + + TaxonomyIndexArrays tia = new TaxonomyIndexArrays(reader); + assertEquals(0, tia.parents().length()); Review Comment: I don't think it is a valid use-case, but I think there is something to tweak with the checks in the constructors. The previous conditions were trying to check for an empty array, but with the way `allocateChunkedArray` turned out in the end, that was no longer the correct condition to check for. -- 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