import { FullTextSearchCodebaseIndex } from "../../indexing/FullTextSearch.js";
export async function retrieveFts(query, n, tags, filterDirectory) {
    const ftsIndex = new FullTextSearchCodebaseIndex();
    let ftsResults = [];
    try {
        if (query.trim() !== "") {
            ftsResults = await ftsIndex.retrieve(tags, query
                .trim()
                .split(" ")
                .map((element) => `"${element}"`)
                .join(" OR "), n, filterDirectory, undefined);
        }
        return ftsResults;
    }
    catch (e) {
        console.warn("Error retrieving from FTS:", e);
        return [];
    }
}
