Navigation Menu

Skip to content

Commit

Permalink
sub_filter: fix too much score with a too filtered case
Browse files Browse the repository at this point in the history
  • Loading branch information
komainu8 committed Jun 4, 2018
1 parent 2e0a9e4 commit c34e7cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions lib/proc.c
Expand Up @@ -2370,6 +2370,15 @@ run_sub_filter(grn_ctx *ctx, grn_obj *table,
GRN_OBJ_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC,
scope_domain, NULL);
if (op == GRN_OP_AND && sub_filter_pre_filter(ctx, res, scope, base_res)) {
if (base_res) {
void *key = NULL, *value = NULL;
uint32_t key_size = 0;

GRN_TABLE_EACH(ctx, base_res, 0, 0, id, &key, &key_size, &value, {
grn_rset_recinfo *ri = value;
ri->score = 0;
});
}
select_op = GRN_OP_AND;
}
grn_table_select(ctx, scope_domain, sub_filter, base_res, select_op);
Expand Down
Expand Up @@ -33,7 +33,7 @@ load --table Packages
{"_key": "mroonga", "files": ["ha_mroonga.cc", "ha_mroonga.hpp"]}
]
[[0,0.0,0.0],3]
select Packages --filter '_key @ "rroonga" && sub_filter(files, "revision >= 10 && revision < 40")' --output_columns '_key, files, files.revision'
select Packages --filter '_key @ "rroonga" && sub_filter(files, "revision >= 10 && revision < 40")' --output_columns '_key, _score, files, files.revision'
[
[
0,
Expand All @@ -50,6 +50,10 @@ select Packages --filter '_key @ "rroonga" && sub_filter(files, "revision >= 1
"_key",
"ShortText"
],
[
"_score",
"Int32"
],
[
"files",
"Files"
Expand All @@ -61,6 +65,7 @@ select Packages --filter '_key @ "rroonga" && sub_filter(files, "revision >= 1
],
[
"rroonga",
5,
[
"lib/groonga.rb",
"README.textile"
Expand Down
Expand Up @@ -32,4 +32,4 @@ load --table Packages

select Packages \
--filter '_key @ "rroonga" && sub_filter(files, "revision >= 10 && revision < 40")' \
--output_columns '_key, files, files.revision'
--output_columns '_key, _score, files, files.revision'

0 comments on commit c34e7cd

Please sign in to comment.