diff --git a/core/context/retrieval.ts b/core/context/retrieval.ts index 6d9a26925..547977257 100644 --- a/core/context/retrieval.ts +++ b/core/context/retrieval.ts @@ -137,7 +137,7 @@ export async function retrieveContextItemsFromEmbeddings( if (extras.fullInput.trim() !== "") { ftsResults = await ftsIndex.retrieve( tags, - extras.fullInput.trim().split(" ").join(" OR "), + extras.fullInput.trim().split(" ").map(element => `"${element}"`).join(" OR "), nRetrieve / 2, filterDirectory, undefined diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index ca8fd97eb..97bb0d2a3 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -165,12 +165,14 @@ async function getAddRemoveForTag( case AddRemoveResultType.Remove: await db.run( `DELETE FROM tag_catalog WHERE - path IN (?) AND + cacheKey = ? AND + path = ? AND dir = ? AND branch = ? AND artifactId = ? `, - remove.map((r) => `'${r.path}'`).join(", "), + cacheKey, + path, tag.directory, tag.branch, tag.artifactId