Fix ParadeDB fuzzy query parameter casting
Cast the bound search parameter through text before so Postgrex can handle the prepared statement type inference. Add matching test assertion updates.
This commit is contained in:
parent
7efd296afb
commit
4e65bbf134
2 changed files with 2 additions and 2 deletions
|
|
@ -235,7 +235,7 @@ defmodule Pleroma.Search.ParadeDB do
|
|||
end
|
||||
|
||||
defp search_query_param_sql(0), do: "$1"
|
||||
defp search_query_param_sql(distance), do: "$1::pdb.fuzzy(#{distance})"
|
||||
defp search_query_param_sql(distance), do: "($1::text)::pdb.fuzzy(#{distance})"
|
||||
|
||||
defp create_table_sql(table) do
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ defmodule Pleroma.Search.ParadeDBTest do
|
|||
ClientMock
|
||||
|> expect(:query, fn sql, params ->
|
||||
assert sql =~ "SELECT id FROM pleroma_search_documents"
|
||||
assert sql =~ "$1::pdb.fuzzy(1)"
|
||||
assert sql =~ "($1::text)::pdb.fuzzy(1)"
|
||||
assert ["running shoes", _limit, _offset] = params
|
||||
|
||||
{:ok, %{rows: [[dumped_id]]}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue