txwei commented on code in PR #16801:
URL: https://github.com/apache/lucene/pull/16801#discussion_r4300721577


##########
lucene/join/src/java/org/apache/lucene/search/join/TermsQuery.java:
##########
@@ -99,6 +99,17 @@ public long getTermsCount() {
     return terms.size();
   }
 
+  @Override
+  public long estimateCost(Terms terms) throws IOException {
+    // Copied from org.apache.lucene.search.TermInSetQuery.estimateCost
+    long potentialExtraCost = terms.getSumDocFreq();
+    final long indexedTermCount = terms.size();
+    if (indexedTermCount != -1) {
+      potentialExtraCost -= indexedTermCount;
+    }
+    return terms.size() + potentialExtraCost;

Review Comment:
   ```suggestion
       return this.terms.size() + potentialExtraCost;
   ```
   
   The `terms` parameter here shadows the class field. Or can we rename the 
class to prevent this collision?



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

Reply via email to