[
https://issues.apache.org/jira/browse/SOLR-17369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17865610#comment-17865610
]
Chris M. Hostetter commented on SOLR-17369:
-------------------------------------------
{quote} ... parses the {{raw_vec}} param as a {{ConstKnnFloatValueSource}} (the
default) even if {{my_vec_field}} uses {{BYTE}} encoding.
{quote}
This can manifest as the very confusing...
{noformat}
java.lang.UnsupportedOperationException
at
org.apache.lucene.queries.function.FunctionValues.byteVectorVal(FunctionValues.java:79)
at
org.apache.lucene.queries.function.valuesource.ByteVectorSimilarityFunction.func(ByteVectorSimilarityFunction.java:39)
at
org.apache.lucene.queries.function.valuesource.VectorSimilarityFunction$1.floatVal(VectorSimilarityFunction.java:52)
at
org.apache.lucene.queries.function.FunctionQuery$AllScorer.score(FunctionQuery.java:130){noformat}
> FunctionQParser's $param derefrencing ignores flags: breaks two arg
> vectorySimilarity() 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
> Priority: Major
>
> 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]