gautamworah96 commented on a change in pull request #2247: URL: https://github.com/apache/lucene-solr/pull/2247#discussion_r566976943
########## File path: lucene/facet/src/java/org/apache/lucene/facet/taxonomy/directory/DirectoryTaxonomyReader.java ########## @@ -353,12 +349,65 @@ public FacetLabel getPath(int ordinal) throws IOException { } synchronized (categoryCache) { - categoryCache.put(catIDInteger, ret); + categoryCache.put(ordinal, ret); } return ret; } + private FacetLabel getPathFromCache(int ordinal) { + ensureOpen(); Review comment: This seems much better. Updated. My initial impression was that `ensureOpen()` needs to be called before looking up each ordinal. ########## File path: lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java ########## @@ -569,4 +569,31 @@ public void testAccountable() throws Exception { taxoReader.close(); dir.close(); } + + public void testBulkPath() throws Exception { + Directory src = newDirectory(); + DirectoryTaxonomyWriter w = new DirectoryTaxonomyWriter(src); + String arr[] = new String[] {"a", "b", "c", "d", "e"}; + + FacetLabel allpaths[] = new FacetLabel[arr.length]; + int allords[] = new int[arr.length]; + + for (int i = 0; i < arr.length; i++) { + allpaths[i] = new FacetLabel(arr[i]); + w.addCategory(allpaths[i]); + } + w.commit(); + w.close(); + + DirectoryTaxonomyReader r1 = new DirectoryTaxonomyReader(src); + + for (int i = 0; i < allpaths.length; i++) { + allords[i] = r1.getOrdinal(allpaths[i]); + } + + FacetLabel allBulkpath[] = r1.getBulkPath(allords); + assertArrayEquals(allpaths, allBulkpath); Review comment: Added ---------------------------------------------------------------- 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. 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