Skip to content

Commit

Permalink
using whitespace as analyzer reduces too much the matched items
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas committed Aug 31, 2020
1 parent 48c05f6 commit 6f6c4fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/Page/Options.elm
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/Page/Packages.elm
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/Search.elm
Expand Up @@ -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)
)
]
)
Expand Down

0 comments on commit 6f6c4fe

Please sign in to comment.