[ 
https://issues.apache.org/jira/browse/SOLR-17369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris M. Hostetter updated SOLR-17369:
--------------------------------------
    Attachment: SOLR-17369-1.patch
        Status: Open  (was: Open)

added some more tests.

> 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: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to