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" => [ %{