import { NextRequest, NextResponse } from "next/server";
import { performQuery } from "app/_lib/opensearch";

export const GET = async (req: NextRequest) => {
    const searchQuery = req.nextUrl.searchParams.get("searchQuery");
    const rawQuery = await JSON.parse(decodeURI(searchQuery as string));
    const results = await performQuery(rawQuery, 1000);

    return NextResponse.json(results);
};


