alessandrobenedetti commented on PR #1245: URL: https://github.com/apache/solr/pull/1245#issuecomment-1361889301
Ok, I'll produce another branch with the example code assuming Lucene changes are there. So what I am trying to accomplish: 1) Knn Query has a Query filter as a constructor parameter (and instance variable). This filter is meant to be a pre-filter(in Approximate Nearest Neighbour search means a filter that is executed before the Top K nearest neighbors are returned). It is used internally in the approximate nearest neighbor search Lucene code to only accept certain neighbors from the graph(along with the alive bitSet) 2) In Apache Solr we need to make sure that all filter queries except explicit post-filters are processed and set in the Knn Query. 3) But parsing happens before the Searcher will process the filters. So if are able to modify the Lucene KnnQuery in org.apache.solr.search.QueryUtils#combineQueryAndFilter (or create a new one), we are done. Right now we process the filters at parsing time (ad do it again in the Searcher). Potentially we could process and remove the filters from the request in the query parser, but it seems nasty to me, hence my idea of modifying the combineQueryAndFilter. Because that method has the responsibility of building a new Query, combining the main Query and all filters(except post-filters). So it seems the perfect place for implementing the custom logic for the KnnQuery, that behaves differently when you combine it with filters. Hope this helps with context @dsmiley ! -- 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