From ba3e9fbaec7e22a938541a807d0c51f4e31d850b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 26 Jan 2021 20:13:52 +0100 Subject: [PATCH] Fix search event query Signed-off-by: Thomas Citharel --- lib/mobilizon/events/events.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index d601fb8ff..6adfd0d84 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -1340,10 +1340,14 @@ defmodule Mobilizon.Events do end @spec events_for_search_query(String.t()) :: Ecto.Query.t() - defp events_for_search_query(""), do: Event + defp events_for_search_query("") do + Event + |> distinct([e], e.id) + end defp events_for_search_query(search_string) do from(event in Event, + distinct: event.id, join: id_and_rank in matching_event_ids_and_ranks(search_string), on: id_and_rank.id == event.id )