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 =
[ ( name, Json.Encode.object object ) ]
in
-- I'm not sure we need fuziness
--, ( "fuzziness", Json.Encode.int 1 )
query
|> stringIn "query"
-- Prefix Query
-- {
-- "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 "match"
|> objectIn "wildcard"
|> objectIn "query"
|> Json.Encode.object
|> Http.jsonBody