我的控制器中有这个搜索功能:
def search(query, search_term) do
(from u in query,
where: fragment("(to_tsvector('portuguese', unaccent(?)) @@ plainto_tsquery(?))", u.name, ^search_term),
order_by: fragment("ts_rank((to_tsvector('portuguese', unaccent(?)), plainto_tsquery(?))) DESC", u.name, ^search_term))
end
我收到此错误:
ERROR (undefined_function): function unaccent(character varying) does not exist
我还在PostgreSQL中添加了unaccented
扩展名:
CREATE EXTENSION unaccent;
如何使这项工作?