You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/07/06 14:22:14 UTC

[GitHub] [solr] alessandrobenedetti commented on a diff in pull request #904: SOLR-16246: Introduced pre-filtering in KnnQParser

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


##########
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:
   Yes, @cpoerschke , I have done some investigations and it seems that the callers that were not setting it, should have done that, so it shouldn't be parametric



-- 
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-unsubscribe@solr.apache.org

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


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