-
Notifications
You must be signed in to change notification settings - Fork 116
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
expr adjust: fix invalid weight with multiple adjusts #1554
Conversation
Hmm... It seems that we just need the following change: diff --git a/lib/expr.c b/lib/expr.c
index 29fa00cea..cd7a13e70 100644
--- a/lib/expr.c
+++ b/lib/expr.c
@@ -4431,8 +4434,8 @@ parse_query_accept_adjust(grn_ctx *ctx,
float weight)
{
if (!(q->flags & GRN_EXPR_QUERY_NO_SYNTAX_ERROR)) {
- parse_query_push_weight(ctx, q, weight);
PARSE(token);
+ parse_query_push_weight(ctx, q, weight);
return;
} |
@kou Thank you for your comments. |
lib/grn_ecmascript.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you revert this?
Could you add why/when this problem is happen and how to fix this problem to the pull request description? |
I updated he pull request description. |
FYI: My version: GitHub: fix GH-1548 Weights are managed by stack. Currently, if we specify multiple weights in search query ("<0.1title:@groonga <0.3content:@Full"), Groonga doesn't pops the current weight ("0.1" for "<0.1title:@groonga") after the weight's scope is finished ("0.1" in "<0.1title:@groonga") and the next weight ("0.3" in "<0.3content:@Full") is popped after it's pushed. So the next condition ("content:@Full") uses the first weight ("0.1") not the second weight ("0.3"). Example (
Therefore, the latest weight doesn't apply result. With this change, multiple weights are applied correctly:
|
GitHub: fix GH-1548
The weight value that a user specify is pushed in stack.
This value pop in
PARSE()
.Currently, If we specify multiple weights in search query, Groonga pop the latest weight immediately after Groonga it push in stack.
Therefore, the latest weight doesn't apply result.
As a result, the previous weight is multiple applied.
In this modification, multiple weight are applied correctly by pushing weight in stack after Groonga execute
PARSE()
.