alessandrobenedetti commented on code in PR #904:
URL: https://github.com/apache/solr/pull/904#discussion_r914906892
##########
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java:
##########
@@ -72,7 +78,41 @@ public Query parse() {
DenseVectorField denseVectorType = (DenseVectorField) fieldType;
float[] parsedVectorToSearch = parseVector(vectorToSearch,
denseVectorType.getDimension());
- return denseVectorType.getKnnVectorQuery(schemaField.getName(),
parsedVectorToSearch, topK);
+
+ return denseVectorType.getKnnVectorQuery(
+ schemaField.getName(), parsedVectorToSearch, topK, getFilterQuery());
+ }
+
+ private Query getFilterQuery() throws SolrException {
+ if (!isFilter()) {
+ String[] filterQueries = req.getParams().getParams(CommonParams.FQ);
+ if (filterQueries != null && filterQueries.length != 0) {
+ return computeFilterQuery(filterQueries);
+ }
+ }
+ return null;
+ }
+
+ private Query computeFilterQuery(String[] filterQueries) throws
SolrException {
Review Comment:
do we really need two private methods:
getFilterQuery()
computeFilterQuery(String[] filterQueries)
Can't we just have one "buildFilterQuery()" ?
They don't appear to be that complex to require a split, but I am happy to
reconsider if there was some deep motivation
--
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]