improve search result relevance

This commit is contained in:
Tao Bror Bojlén 2019-08-03 00:25:39 +03:00
parent 76ebf50c40
commit 80c1462866
No known key found for this signature in database
GPG Key ID: C6EC7AAB905F9E6F
3 changed files with 10 additions and 26 deletions

View File

@ -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

View File

@ -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
}
}
]
}

View File

@ -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"
}
}
},