Skip to content

Commit

Permalink
fix search redirect from home page
Browse files Browse the repository at this point in the history
  • Loading branch information
cbh123 committed Sep 27, 2023
1 parent 4c5e606 commit d5d5228
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/emoji_web/live/search_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ defmodule EmojiWeb.SearchLive do
)}
end

@impl true
def handle_params(%{"q" => query}, _uri, socket) do
Task.async(fn -> Emoji.Embeddings.search_emojis(query, 3, false) end)

{:noreply,
socket
|> assign(
loading: true,
form: to_form(%{"query" => query})
)}
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, 3, search_via_images == "true") end)
Expand Down

0 comments on commit d5d5228

Please sign in to comment.