diff --git a/CHANGELOG.md b/CHANGELOG.md index 45dcbfe..d2e8c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Performance improvements when opening the app on something that isn't the graph. +- There are now fewer irrelevant search results. ### Deprecated diff --git a/backend/lib/backend/api.ex b/backend/lib/backend/api.ex index 2521054..8b3d017 100644 --- a/backend/lib/backend/api.ex +++ b/backend/lib/backend/api.ex @@ -115,6 +115,7 @@ defmodule Backend.Api do "sort" => "_score", "from" => from, "size" => page_size, + "min_score" => 1, "query" => %{ "bool" => %{ "filter" => %{ @@ -127,7 +128,8 @@ defmodule Backend.Api do "multi_match" => %{ "query" => query, "fields" => [ - "description.english" + "description.english", + "domain.english" ] } }, @@ -143,14 +145,9 @@ defmodule Backend.Api do "wildcard" => %{ "domain.keyword" => %{ "value" => "*#{query}*", - "boost" => 1 + "boost" => 50 } } - }, - %{ - "match" => %{ - "domain.ngram^0.5" => query - } } ] } diff --git a/backend/priv/elasticsearch/instances.json b/backend/priv/elasticsearch/instances.json index 2151b60..714889b 100644 --- a/backend/priv/elasticsearch/instances.json +++ b/backend/priv/elasticsearch/instances.json @@ -1,21 +1,7 @@ { "settings": { "number_of_shards": 1, - "number_of_replicas": 0, - "analysis": { - "analyzer": { - "ngramAnalyzer": { - "tokenizer": "ngramTokenizer" - } - }, - "tokenizer": { - "ngramTokenizer": { - "type": "ngram", - "min_gram": 5, - "max_gram": 5 - } - } - } + "number_of_replicas": 0 }, "mappings": { "_doc": { @@ -23,12 +9,12 @@ "domain": { "type": "text", "fields": { - "ngram": { - "type": "text", - "analyzer": "ngramAnalyzer" - }, "keyword": { "type": "keyword" + }, + "english": { + "type": "text", + "analyzer": "english" } } },