dsmiley commented on code in PR #1245:
URL: https://github.com/apache/solr/pull/1245#discussion_r1055519447


##########
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java:
##########
@@ -84,30 +84,20 @@ public Query parse() {
   }
 
   private Query getFilterQuery() throws SolrException {
-    if (!isFilter()) {
+    boolean isSubQuery = recurseCount != 0;
+    if (!isFilter() && !isSubQuery) {
       String[] filterQueries = req.getParams().getParams(CommonParams.FQ);
       if (filterQueries != null && filterQueries.length != 0) {
-        List<Query> filters;
-
         try {
-          filters = QueryUtils.parseFilterQueries(req, true);
-        } catch (SyntaxError e) {
+          List<Query> filters = QueryUtils.parseFilterQueries(req, true);
+          SolrIndexSearcher.ProcessedFilter processedFilter =
+              req.getSearcher().getProcessedFilter(filters);
+          return processedFilter.filter;
+        } catch (SyntaxError | IOException e) {

Review Comment:
   Don't catch SyntaxError; propagate it. getFilterQuery will indirectly parse 
and this is in the context of query parsing; SyntaxError is a declared 
exception of QueryParser.parse.



##########
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java:
##########
@@ -84,30 +84,20 @@ public Query parse() {
   }
 
   private Query getFilterQuery() throws SolrException {
-    if (!isFilter()) {
+    boolean isSubQuery = recurseCount != 0;
+    if (!isFilter() && !isSubQuery) {

Review Comment:
   Why is isFilter being checked?  Why is isSubQuery being checked?  In my 
experience, use of these is extremely rare.  isFilter... that would only be 
pertinent if the KNN query was specified in a filter query (`fq`), which is 
kind of surprising because AFAIK, KNN is for relevancy (scoring).  Does this 
query need to operate differently or to make more optimal decisions if it's in 
a filter query (to only filter and not rank)?



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