feat(query): add basic regular expression operator support - refs #2236

This commit is contained in:
Michael Kane Juncker
2022-04-11 08:33:16 +02:00
committed by Wolfgang Walther
parent a768bcbf20
commit 007f49a8bc
5 changed files with 47 additions and 17 deletions
+23
View File
@@ -129,6 +129,29 @@ spec actualPgVersion = do
it "matches with ilike using not operator" $
get "/simple_pk?k=not.ilike.xy*&order=extra.asc" `shouldRespondWith` "[]"
it "matches with ~" $ do
get "/simple_pk?k=match.yx$" `shouldRespondWith`
[json|[{"k":"xyyx","extra":"u"}]|]
get "/simple_pk?k=match.^xy" `shouldRespondWith`
[json|[{"k":"xyyx","extra":"u"}]|]
get "/simple_pk?k=match.YY" `shouldRespondWith`
[json|[{"k":"xYYx","extra":"v"}]|]
it "matches with ~ using not operator" $
get "/simple_pk?k=not.match.yx$" `shouldRespondWith`
[json|[{"k":"xYYx","extra":"v"}]|]
it "matches with ~*" $ do
get "/simple_pk?k=imatch.^xy&order=extra.asc" `shouldRespondWith`
[json|[{"k":"xyyx","extra":"u"},{"k":"xYYx","extra":"v"}]|]
{ matchHeaders = [matchContentTypeJson] }
get "/simple_pk?k=imatch..*YY.*&order=extra.asc" `shouldRespondWith`
[json|[{"k":"xyyx","extra":"u"},{"k":"xYYx","extra":"v"}]|]
{ matchHeaders = [matchContentTypeJson] }
it "matches with ~* using not operator" $
get "/simple_pk?k=not.imatch.^xy&order=extra.asc" `shouldRespondWith` "[]"
describe "Full text search operator" $ do
it "finds matches with to_tsquery" $
get "/tsearch?text_search_vector=fts.impossible" `shouldRespondWith`