From 693aa579c6e5974773b9193af91b1692b0ec13b9 Mon Sep 17 00:00:00 2001 From: Charlie Holtz Date: Wed, 27 Sep 2023 16:21:11 -0400 Subject: [PATCH] fix pattern matching --- lib/emoji_web/live/search_live.ex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/emoji_web/live/search_live.ex b/lib/emoji_web/live/search_live.ex index 50646e0..458623d 100644 --- a/lib/emoji_web/live/search_live.ex +++ b/lib/emoji_web/live/search_live.ex @@ -28,28 +28,28 @@ defmodule EmojiWeb.SearchLive do end @impl true - def handle_params(%{"q" => query}, _uri, socket) do - Task.async(fn -> Emoji.Embeddings.search_emojis(query, @num_results, false) end) + def handle_params(%{"q" => query, "search_via_images" => search_via_images}, _uri, socket) do + Task.async(fn -> + Emoji.Embeddings.search_emojis(query, @num_results, search_via_images == "true") + end) {:noreply, socket |> assign( loading: true, - form: to_form(%{"query" => query}) + form: to_form(%{"query" => query, "search_via_images" => search_via_images}) )} end @impl true - def handle_params(%{"q" => query, "search_via_images" => search_via_images}, _uri, socket) do - Task.async(fn -> - Emoji.Embeddings.search_emojis(query, @num_results, search_via_images == "true") - end) + def handle_params(%{"q" => query}, _uri, socket) do + Task.async(fn -> Emoji.Embeddings.search_emojis(query, @num_results, false) end) {:noreply, socket |> assign( loading: true, - form: to_form(%{"query" => query, "search_via_images" => search_via_images}) + form: to_form(%{"query" => query}) )} end