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

Function score doesn't require a function and can specify a weight #74

Closed
astralarya opened this issue May 21, 2015 · 3 comments
Closed

Comments

@astralarya
Copy link

As of 1.4, elasticsearch has added a weight parameter to function score functions. Futhermore, function score queries do not require a score function if they have both a filter and a weight.

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html

@olivere
Copy link
Owner

olivere commented May 22, 2015

Hi there! Sorry for the delay. I'm currently OOO and will review your PR ASAP. Thanks for working on this.

@olivere
Copy link
Owner

olivere commented May 26, 2015

I'm currently looking into this. If you have the time, maybe we could figure this out together.

I model the Go code after the Java client as I found the documentation misleading or incomplete sometimes (it probably has to). In other words: The Java code is the gold standard for me. Here's the code that implements the Function score feature in Java. Important classes are FunctionScoreQueryBuilder which basically is FunctionScoreQuery in Elastic and ScoreFunctionBuilders which is what you find in search_queries_fsq_score_funcs.go.

However, when comparing the Java code with your implementation, I see that in Java the weights are only applied to the score functions whereas in your PR you add them to the FunctionScoreQuery. Do we agree that it is the correct thing to add them to the score functions?

BTW: I already have a patch available here (if we agree). So no need to change your PR. It fixes some other issues as well (like the min_score field that came with 1.5.0+, deprecation of FactorFunction and addition of WeightFactorFunction).

@olivere
Copy link
Owner

olivere commented May 27, 2015

Closed this for now. Feel free to open a new issue if this doesn't work for you. Cheers.

olivere added a commit that referenced this issue Jun 17, 2015
This commit fixes an issue in where the `weight` field is now correctly
serialized one level above the score function.

Furthermore, we added documentation, the `missing` field for the
`FieldValueFactorFunction` and the `MultiValueMode` for all decay
functions. Finally, we added some documentation.

Closes #85 (see also #74).
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

2 participants