diff options
author | Håvard Pettersen <havardpe@oath.com> | 2021-10-08 11:26:55 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2021-10-08 11:26:55 +0000 |
commit | c1778a3976ac80934caa15c0fa280f71eeb2072c (patch) | |
tree | 09114e47c7e6817d2987afa4b46caf772c0ae541 /searchlib | |
parent | daaf9321988ba1ba0fd81ee3853fdd51dc692f26 (diff) |
extend element size to at least contain all matches
Increase element size rather than reduce the number of matches. This
is to avoid getting scores over 1 for cases where we have matches
outside the element. We do not know if or when this might happen, but
reversing the guard makes it more robust.
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp index 887a246bd76..992d87d382e 100644 --- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp @@ -181,7 +181,8 @@ struct State { } void calculate_scores(size_t num_query_terms, int total_term_weight) { - double matches = std::min(element_length, matched_terms); + element_length = std::max(element_length, matched_terms); + double matches = matched_terms; if (matches < 2) { proximity = proximity_score(element_length); order = (num_query_terms == 1) ? 1.0 : 0.0; |