gautamworah96 commented on a change in pull request #179: URL: https://github.com/apache/lucene/pull/179#discussion_r696973661
########## File path: lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java ########## @@ -567,4 +567,39 @@ public void testAccountable() throws Exception { taxoReader.close(); dir.close(); } + + public void testCallingBulkPathReturnsCorrectResult() throws Exception { + float PROBABILITY_OF_COMMIT = 0.5f; + Directory src = newDirectory(); + DirectoryTaxonomyWriter w = new DirectoryTaxonomyWriter(src); + String randomArray[] = new String[random().nextInt(1000)]; + // adding a smaller bound on ints ensures that we will have some duplicate ordinals in random + // test cases + Arrays.setAll(randomArray, i -> Integer.toString(random().nextInt(500))); + + FacetLabel allPaths[] = new FacetLabel[randomArray.length]; + int allOrdinals[] = new int[randomArray.length]; + + for (int i = 0; i < randomArray.length; i++) { + allPaths[i] = new FacetLabel(randomArray[i]); + w.addCategory(allPaths[i]); + // add random commits to create multiple segments in the index + if (random().nextFloat() < PROBABILITY_OF_COMMIT) { + w.commit(); + } + } + w.commit(); + w.close(); + + DirectoryTaxonomyReader r1 = new DirectoryTaxonomyReader(src); + + for (int i = 0; i < allPaths.length; i++) { Review comment: Sure. I modified the test to that it uses random multiple threads, each thread use random iterations, each iteration tests the path of random number of ordinals . Debugging this test will be a task if it fails :| -- 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