Skip to content

Commit

Permalink
reduce boost for lookup in ngram indexes of default langauges
Browse files Browse the repository at this point in the history
The mixing of languages seems to result in scores of a different
order, leading to the occasional odd preference of name matching over
importance. Experiment to reduce the boost for default.
  • Loading branch information
lonvia committed Feb 9, 2024
1 parent eb282bd commit 8fce0d1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private PhotonQueryBuilder(String query, String language, String[] languages, bo
// 1. All terms of the quey must be contained in the place record somehow. Be more lenient on second try.
MultiMatchQueryBuilder builder =
QueryBuilders.multiMatchQuery(query)
.field("collector.default", 1.0f)
.field("collector.default", 0.8f)
.type(lenient ? MultiMatchQueryBuilder.Type.BEST_FIELDS : MultiMatchQueryBuilder.Type.CROSS_FIELDS)
.prefixLength(2)
.analyzer("search_ngram")
Expand All @@ -72,7 +72,7 @@ private PhotonQueryBuilder(String query, String language, String[] languages, bo
// 2. Prefer records that have the full names in. For address records with housenumbers this is the main
// filter creterion because they have no name. Therefore boost the score in this case.
MultiMatchQueryBuilder hnrQuery = QueryBuilders.multiMatchQuery(query)
.field("collector.default.raw", 1.0f)
.field("collector.default.raw", 0.8f)
.type(MultiMatchQueryBuilder.Type.BEST_FIELDS);

for (String lang : languages) {
Expand Down

0 comments on commit 8fce0d1

Please sign in to comment.