epotyom commented on code in PR #16783:
URL: https://github.com/apache/lucene/pull/16783#discussion_r4207973311
##########
lucene/CHANGES.txt:
##########
@@ -606,6 +606,10 @@ Optimizations
* GITHUB#16667: Rewrite BooleanQuery to MatchNoDocsQuery when it has MUST_NOT
clause matching one of
its MUST boost or constant score query clauses. (Egor Potemkin)
+* GITHUB#XXXXX: DirectoryTaxonomyReader#getBulkOrdinals now returns early when
every requested label
Review Comment:
Please replace with real PR id!
##########
lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java:
##########
@@ -716,4 +716,22 @@ public void testGetPathAndOrdinalsRandomMultithreading()
throws Exception {
r1.close();
src.close();
}
+
+ public void testGetBulkOrdinalsAllCached() throws Exception {
+ Directory dir = newDirectory();
+ DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir);
+ FacetLabel a = new FacetLabel("a");
+ FacetLabel b = new FacetLabel("b");
+ int[] ords = {taxoWriter.addCategory(a), taxoWriter.addCategory(b)};
+ taxoWriter.close();
+
+ DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(dir);
+ taxoReader.getBulkOrdinals(a, b); // fills the ordinal cache
+ // all ordinals are cached now, so the lookup must not touch the index
reader at all
+ taxoReader.getInternalIndexReader().close();
Review Comment:
Nice trick :-)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]