bhabegger commented on code in PR #2912:
URL: https://github.com/apache/jackrabbit-oak/pull/2912#discussion_r3289114663


##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java:
##########
@@ -960,6 +977,116 @@ private int getMaxPossibleNumDocs(Map<String, 
PropertyDefinition> propDefns, Fil
         return minNumDocs;
     }
 
+    /**
+     * OAK-12221: cost estimation using a multiplicative selectivity model.
+     * <p>
+     * Each indexed condition contributes a selectivity (the probability that 
a document
+     * satisfies the condition, given it has the field): {@code mcvFraction} 
for MCV matches,
+     * {@code 1/weight} when only a weight is known, and {@code 1.0} when 
{@code weight == 1}.
+     * The combined selectivity is the product of all per-condition 
selectivities, applied
+     * once at the end against the most restrictive field's doc count. This 
makes the
+     * estimate independent of iteration order.
+     */
+    private int getMaxPossibleNumDocsBySelectivity(Map<String, 
PropertyDefinition> propDefns, Filter filter) {
+        IndexStatistics indexStatistics = indexNode.getIndexStatistics();
+        if (indexStatistics == null) {

Review Comment:
   Well there is testing the method itself (aka what situations lead to what 
number of docs) and the impact that it entails (what index gets selected). They 
are close but not exactly the same either. But if you are satisfied with the 
coverage, I'm fine. 



-- 
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]

Reply via email to