switching to wildcard query (#10)

fixes #6
This commit is contained in:
Rok Garbas 2020-05-11 12:52:07 +02:00 committed by GitHub
parent 9064063529
commit 3918246b24
Failed to generate hash of commit

View file

@ -244,12 +244,38 @@ makeRequestBody field query =
objectIn name object = objectIn name object =
[ ( name, Json.Encode.object object ) ] [ ( name, Json.Encode.object object ) ]
in in
-- I'm not sure we need fuziness -- Prefix Query
--, ( "fuzziness", Json.Encode.int 1 ) -- {
query -- "query": {
|> stringIn "query" -- "prefix": {
-- "user": {
-- "value": ""
-- }
-- }
-- }
-- }
--query
-- |> stringIn "value"
-- |> objectIn field
-- |> objectIn "prefix"
-- |> objectIn "query"
-- |> Json.Encode.object
-- |> Http.jsonBody
--
-- Wildcard Query
-- {
-- "query": {
-- "wildcard": {
-- "<field>": {
-- "value": "*<value>*",
-- }
-- }
-- }
-- }
("*" ++ query ++ "*")
|> stringIn "value"
|> objectIn field |> objectIn field
|> objectIn "match" |> objectIn "wildcard"
|> objectIn "query" |> objectIn "query"
|> Json.Encode.object |> Json.Encode.object
|> Http.jsonBody |> Http.jsonBody