magibney commented on a change in pull request #592:
URL: https://github.com/apache/solr/pull/592#discussion_r802988483



##########
File path: solr/core/src/java/org/apache/solr/search/QueryUtils.java
##########
@@ -54,23 +54,7 @@ public static boolean isNegative(Query q) {
    * varying score (i.e., it is a constant score query).
    */
   public static boolean isConstantScoreQuery(Query q) {
-    return isConstantScoreQuery(q, null);
-  }
-
-  private static Map<Query, Void> lazyInitSeen(Map<Query, Void> seen, Query 
add) {
-    if (seen == null) {
-      seen = new IdentityHashMap<>();
-    }
-    seen.put(add, null);
-    return seen;
-  }
-
-  /**
-   * Returns true if the specified query is guaranteed to assign the same 
score to all docs; otherwise false
-   * @param q query to be evaluated
-   * @param seen used to detect possible loops in nested query input
-   */
-  private static boolean isConstantScoreQuery(Query q, Map<Query, Void> seen) {
+    Map<Query, Void> seen = null; // lazy-init; this will be unnecessary in 
many cases

Review comment:
       This comment is also relevant:
   ```
   // NOTE: Neither WrappedQuery class nor its inner query are final, so there 
is a risk of direct loops
   // TODO: Only the queries we explicitly check for in this method are 
relevant wrt detecting loops, and
   //  only `WrappedQuery` currently presents a risk in that respect; we may be 
able to avoid this risk
   //  by more tightly restricting the `WrappedQuery` API (e.g., making the 
get/set methods `final`)?
   ```




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