Using whitespace as analyzer reduces too much the matched items (#174)

This commit is contained in:
Rok Garbas 2020-08-31 11:39:05 +02:00 committed by GitHub
parent 48c05f60ed
commit 2ffaefeba0
Failed to generate hash of commit
3 changed files with 11 additions and 11 deletions

View file

@ -288,9 +288,9 @@ makeRequest options channel query from size sort =
sort
"option"
"option_name"
[ "option_name^2"
, "option_name_query^2"
, "option_description^1"
[ "option_name^2.2"
, "option_name_query^2.1"
, "option_description^1."
]
)
("latest-" ++ String.fromInt options.mappingSchemaVersion ++ "-" ++ channel)

View file

@ -414,11 +414,11 @@ makeRequest options channel query from size sort =
sort
"package"
"package_attr_name"
[ "package_attr_name^2"
, "package_attr_name_query^2"
, "package_pname^2"
, "package_description^1"
, "package_longDescription^1"
[ "package_attr_name^2.3"
, "package_pname^2.2"
, "package_attr_name_query^2.1"
, "package_description^1."
, "package_longDescription^1."
]
)
("latest-" ++ String.fromInt options.mappingSchemaVersion ++ "-" ++ channel)

View file

@ -748,17 +748,17 @@ search_fields query fields =
(\queryIndex queryWord ->
[ ( "multi_match"
, Json.Encode.object
[ ( "type", Json.Encode.string "most_fields" )
[ ( "type", Json.Encode.string "bool_prefix" )
, ( "query", Json.Encode.string queryWord )
, ( "fuzziness", Json.Encode.int <| String.length queryWord // 5 )
, ( "analyzer", Json.Encode.string "whitespace" )
, ( "prefix_length", Json.Encode.int 3 )
, ( "operator", Json.Encode.string "or" )
, ( "_name"
, Json.Encode.string <| "multi_match_" ++ queryWord ++ "_" ++ (queryIndex + 1 |> String.fromInt)
)
, ( "fields"
, Json.Encode.list Json.Encode.string
(List.map (\field -> field ++ "." ++ (queryIndex + 1 |> String.fromInt)) fields)
(List.map (\field -> field ++ (queryIndex + 1 |> String.fromInt)) fields)
)
]
)