[
https://issues.apache.org/jira/browse/SOLR-16858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Joel Bernstein updated SOLR-16858:
----------------------------------
Description:
The KnnQParser is parsing the filter query which limits the rows considered by
the vector query by doing this:
{code:java}
private Query getFilterQuery() throws SolrException, SyntaxError {
boolean isSubQuery = recurseCount != 0;
if (!isFilter() && !isSubQuery) {
String[] filterQueries = req.getParams().getParams(CommonParams.FQ);
if (filterQueries != null && filterQueries.length != 0) {
try {
List<Query> filters = QueryUtils.parseFilterQueries(req);
SolrIndexSearcher.ProcessedFilter processedFilter =
req.getSearcher().getProcessedFilter(filters);
return processedFilter.filter;
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
}
}
return null;
}
{code}
This is pulling all filter queries from the main query parameters and using
them to limit the vector query.
I don't believe this is the behavior we actually want. What we want is to add
an "fq" to the local params of the Knn vector query. Here is the example syntax:
{code:java}
{!knn f=vector topK=10 fq=$kfq}[...]&kfq=myquery
{code}
We could make the current behavior optional, with a flag such as:
{code:java}
{!knn f=vector topK=10 addFilters=true}[...]
{code}
was:
The KnnQParser is parsing the filter query which limits the rows considered by
the vector query by doing this:
{code:java}
private Query getFilterQuery() throws SolrException, SyntaxError {
boolean isSubQuery = recurseCount != 0;
if (!isFilter() && !isSubQuery) {
String[] filterQueries = req.getParams().getParams(CommonParams.FQ);
if (filterQueries != null && filterQueries.length != 0) {
try {
List<Query> filters = QueryUtils.parseFilterQueries(req);
SolrIndexSearcher.ProcessedFilter processedFilter =
req.getSearcher().getProcessedFilter(filters);
return processedFilter.filter;
} catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
}
}
return null;
}
{code}
This is pulling all filter queries from the main query parameters and using
them limit the vector query.
I don't believe this is the behavior we actually want. What we want is to add
an "fq" to the local params of the Knn vector query. Here is the example syntax:
{code:java}
{!knn f=vector topK=10 fq=$kfq}[...]&kfq=myquery
{code}
We could make the current behavior optional, with a flag such as:
{code:java}
{!knn f=vector topK=10 addFilters=true}[...]
{code}
> KnnQParser is parsing filter queries incorrectly
> ------------------------------------------------
>
> Key: SOLR-16858
> URL: https://issues.apache.org/jira/browse/SOLR-16858
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Joel Bernstein
> Priority: Major
>
> The KnnQParser is parsing the filter query which limits the rows considered
> by the vector query by doing this:
> {code:java}
> private Query getFilterQuery() throws SolrException, SyntaxError {
> boolean isSubQuery = recurseCount != 0;
> if (!isFilter() && !isSubQuery) {
> String[] filterQueries = req.getParams().getParams(CommonParams.FQ);
> if (filterQueries != null && filterQueries.length != 0) {
> try {
> List<Query> filters = QueryUtils.parseFilterQueries(req);
> SolrIndexSearcher.ProcessedFilter processedFilter =
> req.getSearcher().getProcessedFilter(filters);
> return processedFilter.filter;
> } catch (IOException e) {
> throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
> }
> }
> }
> return null;
> }
> {code}
> This is pulling all filter queries from the main query parameters and using
> them to limit the vector query.
> I don't believe this is the behavior we actually want. What we want is to add
> an "fq" to the local params of the Knn vector query. Here is the example
> syntax:
> {code:java}
> {!knn f=vector topK=10 fq=$kfq}[...]&kfq=myquery
> {code}
> We could make the current behavior optional, with a flag such as:
> {code:java}
> {!knn f=vector topK=10 addFilters=true}[...]
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]