Add distinct clause to search events
Closes #1174 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
a1b439b724
commit
5225431d60
@ -1272,16 +1272,11 @@ defmodule Mobilizon.Events do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @spec events_for_search_query(String.t()) :: Ecto.Query.t()
|
|
||||||
# defp events_for_search_query("") do
|
|
||||||
# Event
|
|
||||||
# |> join: rank in fragment("")
|
|
||||||
# end
|
|
||||||
|
|
||||||
defp events_for_search_query(search_string) do
|
defp events_for_search_query(search_string) do
|
||||||
from(event in Event,
|
Event
|
||||||
join: id_and_rank in matching_event_ids_and_ranks(search_string),
|
|> distinct(:id)
|
||||||
on: id_and_rank.id == event.id
|
|> join(:inner, [e], id_and_rank in matching_event_ids_and_ranks(search_string),
|
||||||
|
on: id_and_rank.id == e.id
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user