Set search config to 'english'.
This commit is contained in:
parent
9f0a2a714b
commit
73bdfd6c2b
|
@ -289,13 +289,13 @@ def unfollow(%{assigns: %{user: follower}} = conn, %{"id" => id}) do
|
||||||
|
|
||||||
def search(%{assigns: %{user: user}} = conn, %{"q" => query}) do
|
def search(%{assigns: %{user: user}} = conn, %{"q" => query}) do
|
||||||
q = from u in User,
|
q = from u in User,
|
||||||
where: fragment("(to_tsvector(?) || to_tsvector(?)) @@ plainto_tsquery(?)", u.nickname, u.name, ^query),
|
where: fragment("(to_tsvector('english', ?) || to_tsvector('english', ?)) @@ plainto_tsquery('english', ?)", u.nickname, u.name, ^query),
|
||||||
limit: 20
|
limit: 20
|
||||||
accounts = Repo.all(q)
|
accounts = Repo.all(q)
|
||||||
|
|
||||||
q = from a in Activity,
|
q = from a in Activity,
|
||||||
where: fragment("?->>'type' = 'Create'", a.data),
|
where: fragment("?->>'type' = 'Create'", a.data),
|
||||||
where: fragment("to_tsvector(?->'object'->>'content') @@ plainto_tsquery(?)", a.data, ^query),
|
where: fragment("to_tsvector('english', ?->'object'->>'content') @@ plainto_tsquery('english', ?)", a.data, ^query),
|
||||||
limit: 20
|
limit: 20
|
||||||
statuses = Repo.all(q)
|
statuses = Repo.all(q)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue