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


##########
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:
   So, getMaxPossibleNumDocs first checks the feature toggle, and then if 
enabled calls this method and returns the result... the idea is that once the 
feature toggle is enabled for some time, we can replace the old method 
completely with the new method.
   
   The old and the new method do share some code (copy & pasted) - which would 
be a disadvantage if we have to keep it for a longer time - but it's an 
advantage if we later want to remove the old code.



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