dsmiley commented on a change in pull request #592:
URL: https://github.com/apache/solr/pull/592#discussion_r802988219
##########
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:
Yes definitely; it's simply wrong to create a circular reference in the
first place. It's very unreasonable to expect every consumer to have to check
for this.
--
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]