eliaporciani commented on code in PR #904:
URL: https://github.com/apache/solr/pull/904#discussion_r911773738


##########
solr/core/src/java/org/apache/solr/search/QueryUtils.java:
##########
@@ -215,4 +221,38 @@ public static Query combineQueryAndFilter(Query 
scoreQuery, Query filterQuery) {
       }
     }
   }
+
+  /**
+   * Parse the filter queries in Solr request
+   *
+   * @param req Solr request
+   * @param fixNegativeQueries if true, negative queries are rewritten by 
adding a MatchAllDocs
+   *     query clause
+   * @return and array of Query. If the request does not contain filter 
queries, returns an empty
+   *     list.
+   * @throws SyntaxError if an error occurs during parsing
+   */
+  public static List<Query> parseFilterQueries(SolrQueryRequest req, boolean 
fixNegativeQueries)
+      throws SyntaxError {
+
+    String[] filterQueriesStr = req.getParams().getParams(CommonParams.FQ);
+
+    if (filterQueriesStr != null) {
+      List<Query> filters = new ArrayList<>(filterQueriesStr.length);
+      for (String fq : filterQueriesStr) {
+        if (fq != null && fq.trim().length() != 0) {
+          QParser fqp = QParser.getParser(fq, req);
+          fqp.setIsFilter(true);

Review Comment:
   I think that adding this kind of parameter might make the method more 
confused and would discourage future usage.  
   setIsFilter(true) is needed for optimizing queries that do not need scoring. 
In the case of KnnQParser, it is also needed for understanding if it is 
necessary to parse recursively the filter queries (and avoid infinite 
recursion).
   I double-checked and scoring is not involved in any scenario involved in 
this refactoring. 



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to