Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing weight parameter in function score query for certain functions #356

Open
Ekimik opened this issue Apr 14, 2021 · 0 comments
Open

Comments

@Ekimik
Copy link

Ekimik commented Apr 14, 2021

Hi,
I am using version 7.2.1 of your library and I have just noticed that I cannot add weight attribute when I am adding field value factor function. Is this intentional? I can see $weight parameter in ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery::addDecayFunction method.

Methods

  • ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery::addFieldValueFactorFunction
  • ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery::addRandomFunction
  • ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery::addScriptScoreFunction

on the other hand do not have this parameter.

As far as I know, you can add weight to any function supported by function score query, see documentation

Because scores can be on different scales (for example, between 0 and 1 for decay functions but arbitrary for field_value_factor) and also because sometimes a different impact of functions on the score is desirable, the score of each function can be adjusted with a user defined weight. The weight can be defined per function in the functions array (example above) and is multiplied with the score computed by the respective function.

I have also noticed that there is method ONGR\ElasticsearchDSL\Query\Compound\FunctionScoreQuery::addSimpleFunction, is this the way I should use to add weight?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant