from fastapi import APIRouter, HTTPException from services.elasticsearch import search_products_by_keywords, search_products_by_filters, get_product_details router = APIRouter() @router.post("/") def handle_search_products_by_keywords(encoded_query: list): products = search_products_by_keywords(encoded_query) if not products: raise HTTPException(status_code=404, detail="No products to recommend") return products