From 8ae1923ca39e81a9175fb4c5597915b791a284e1 Mon Sep 17 00:00:00 2001 From: TJ Date: Wed, 23 Oct 2024 13:52:12 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20belongs=5Fto=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/save_it/bot.ex | 2 +- lib/save_it/typesense_photo.ex | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/save_it/bot.ex b/lib/save_it/bot.ex index 5befcb2..884c2b7 100644 --- a/lib/save_it/bot.ex +++ b/lib/save_it/bot.ex @@ -124,7 +124,7 @@ defmodule SaveIt.Bot do send_message(chat.id, "What do you want to search? animal, food, etc.") _ -> - photos = TypesensePhoto.search_photos!(q) + photos = TypesensePhoto.search_photos!(q, belongs_to_id: chat.id) answer_photos(chat.id, photos) end diff --git a/lib/save_it/typesense_photo.ex b/lib/save_it/typesense_photo.ex index a0da8c2..587b84d 100644 --- a/lib/save_it/typesense_photo.ex +++ b/lib/save_it/typesense_photo.ex @@ -26,7 +26,9 @@ defmodule SaveIt.TypesensePhoto do Typesense.get_document("photos", photo_id) end - def search_photos!(q: q, belongs_to_id: belongs_to_id) do + def search_photos!(q, opts) do + belongs_to_id = Keyword.get(opts, :belongs_to_id) + req_body = %{ "searches" => [ %{