[
https://issues.apache.org/jira/browse/SOLR-17369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867885#comment-17867885
]
ASF subversion and git services commented on SOLR-17369:
--------------------------------------------------------
Commit da7230a7c6095cb8d1a926c377dbb4d43a0db418 in solr's branch
refs/heads/main from Chris M. Hostetter
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=da7230a7c60 ]
SOLR-17369: Fix "flags" usage in FunctionQParser that caused some issues in
vectorSimilarity() with BYTE vector constants
> FunctionQParser's $param derefrencing ignores flags: breaks two arg
> vectorSimilarity() function for BYTE fields when constant vec is param ref
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-17369
> URL: https://issues.apache.org/jira/browse/SOLR-17369
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Chris M. Hostetter
> Assignee: Chris M. Hostetter
> Priority: Major
> Attachments: SOLR-17369-1.patch, SOLR-17369.patch
>
>
> A coworker of mine recently ran into a problem that I believe stems from the
> way {{FunctionQParser}} recursively parses param references.
> When it creates the {{subParser}} that it uses, it does not set it's current
> "flags" on that parser...
> {code:java}
> protected ValueSource parseValueSource(int flags) throws SyntaxError {
> ...
> } else if (ch == '$') {
> sp.pos++;
> String param = sp.getId();
> String val = getParam(param);
> ...
> QParser subParser = subQuery(val, "func");
> if (subParser instanceof FunctionQParser) {
> ((FunctionQParser) subParser).setParseMultipleSources(true);
> }
> Query subQuery = subParser.getQuery();
> ...
> {code}
> One practical problem this causes, that i've seen "in the wild", is in the 2
> argument variant of the {{vectorSimilarity}} function, where the
> {{VectorEncoding}} of the first arg (the field name) is used to set a flag on
> the {{FunctionQParser}} when parsing the second arg (which may be a
> constant vector)
> So something like this works fine, for either {{FLOAT32}} or {{BYTE}}
> fields...
> {noformat}
> q={!func}vectorSimilarity(my_vec_field,[1,...,2,3])
> {noformat}
> But using a param reference like this...
> {noformat}
> q={!func}vectorSimilarity(my_vec_field,$raw_vec)
> raw_vec=[1,...,2,3]
> {noformat}
> ... parses the {{raw_vec}} param as a {{ConstKnnFloatValueSource}} (the
> default) even if {{my_vec_field}} uses {{BYTE}} encoding.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]