vandit.thakkar
vandit.thakkar

Reputation: 121

Passing Ranking function in query text

I have a scenario in which external agent generates ranking function dynamically which I want to pass as a query argument instead of statically defining it in search definition file, something like http://localhost:8080/search/?query=honda car&rankfeature.rankingExpression="query(title_match_weight)*matches(title)+query(tags_match_weight)*matches(tags)"&rankfeature.query(title_match_weight)=10&rankfeature.query(tags_match_weight)=20 which I am not able to do now. Do we have solution to achieve this in Vespa?

I have tried foreach in rank expression command to serve this purpose but it doesn't serve flexibility of having any function dynamically.

http://docs.vespa.ai/documentation/ranking.html#using-query-variables explains about macros and I find that macros is taken as rank-feature and rank feature can be passed in the query. So that should mean macro can be passed in the query which can be used in the expression, but it is not possible.

Upvotes: 1

Views: 225

Answers (1)

Jon
Jon

Reputation: 2339

It's not possible to send ranking expressions with the query (it wouldn't be efficient as they are (often) compiled with LLVM etc).

Couldn't you use a fixed ranking expression and use query features to weight/or turn on or off different parts of it? You can also configure many different ranking expressions and choose between them at query time using ranking.profile=profileName.

Upvotes: 2

Related Questions