From f284ba1898ffa1f96b7f0724e5f3bf3cf14e2e53 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Nov 2021 10:15:16 +0100 Subject: [PATCH] Prefer minimum_should_match instead of and --- server/initializers/constants.ts | 3 ++- server/lib/elastic-search/elastic-search-channels.ts | 3 ++- server/lib/elastic-search/elastic-search-playlists.ts | 3 ++- server/lib/elastic-search/elastic-search-videos.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 7d0ef2f..d20e3a1 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -147,7 +147,8 @@ const REQUESTS = { const ELASTIC_SEARCH_QUERY = { FUZZINESS: 'AUTO:4,7', - OPERATOR: 'AND', + OPERATOR: 'OR', + MINIMUM_SHOULD_MATCH: '75%', BOOST_LANGUAGE_VALUE: 1, MALUS_LANGUAGE_VALUE: 0.5, VIDEOS_MULTI_MATCH_FIELDS: buildMultiMatchFields(CONFIG.VIDEOS_SEARCH.SEARCH_FIELDS), diff --git a/server/lib/elastic-search/elastic-search-channels.ts b/server/lib/elastic-search/elastic-search-channels.ts index 50dccb0..0b8a255 100644 --- a/server/lib/elastic-search/elastic-search-channels.ts +++ b/server/lib/elastic-search/elastic-search-channels.ts @@ -21,7 +21,8 @@ async function queryChannels (search: ChannelsSearchQuery) { query: search.search, fields: ELASTIC_SEARCH_QUERY.CHANNELS_MULTI_MATCH_FIELDS, fuzziness: ELASTIC_SEARCH_QUERY.FUZZINESS, - operator: ELASTIC_SEARCH_QUERY.OPERATOR + operator: ELASTIC_SEARCH_QUERY.OPERATOR, + minimum_should_match: ELASTIC_SEARCH_QUERY.MINIMUM_SHOULD_MATCH } } ] diff --git a/server/lib/elastic-search/elastic-search-playlists.ts b/server/lib/elastic-search/elastic-search-playlists.ts index 9fea02e..8015c9c 100644 --- a/server/lib/elastic-search/elastic-search-playlists.ts +++ b/server/lib/elastic-search/elastic-search-playlists.ts @@ -21,7 +21,8 @@ async function queryPlaylists (search: PlaylistsSearchQuery) { query: search.search, fields: ELASTIC_SEARCH_QUERY.PLAYLISTS_MULTI_MATCH_FIELDS, fuzziness: ELASTIC_SEARCH_QUERY.FUZZINESS, - operator: ELASTIC_SEARCH_QUERY.OPERATOR + operator: ELASTIC_SEARCH_QUERY.OPERATOR, + minimum_should_match: ELASTIC_SEARCH_QUERY.MINIMUM_SHOULD_MATCH } } ] diff --git a/server/lib/elastic-search/elastic-search-videos.ts b/server/lib/elastic-search/elastic-search-videos.ts index bf030ce..0594e21 100644 --- a/server/lib/elastic-search/elastic-search-videos.ts +++ b/server/lib/elastic-search/elastic-search-videos.ts @@ -23,7 +23,8 @@ async function queryVideos (search: VideosSearchQuery) { query: search.search, fields: ELASTIC_SEARCH_QUERY.VIDEOS_MULTI_MATCH_FIELDS, fuzziness: ELASTIC_SEARCH_QUERY.FUZZINESS, - operator: ELASTIC_SEARCH_QUERY.OPERATOR + operator: ELASTIC_SEARCH_QUERY.OPERATOR, + minimum_should_match: ELASTIC_SEARCH_QUERY.MINIMUM_SHOULD_MATCH } } ]