File size: 439 Bytes
c169262 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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
|