Skip to content

VectorSimilarityFunction.getValues() does not implement doubleVal, throws UnsupportedOperationException #15328

@hossman

Description

@hossman

Description

VectorSimilarityFunction (and it's concrete subclasses) are the only ValueSource impls (AFAICT) that produce FunctionValues impls which do override floatVal(doc) but do NOT override doubleVal(doc) -- so they inherits the default impl from the FunctionValues abstract class, throwing UnsupportedOperationException

Practically speaking this means VectorSimilarityFunction subclasses are the only ValueSource impls (AFAICT) that can be used in a FunctionQuery, but can NOT be used in a FunctionScoreQuery because ValueSource.asDoubleValuesSource() delegates to the doubleVal(doc)

Version and environment details

Affects main, and all previous versions of Lucene that contain VectorSimilarityFunction

Fix (with tests) is fairly straight forward: lucene.bug.VectorSimilarityFunction.doubleVal.patch.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions