@typicalday/firegraph 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sqlite/local.cjs +11 -1
- package/dist/sqlite/local.cjs.map +1 -1
- package/dist/sqlite/local.js +11 -1
- package/dist/sqlite/local.js.map +1 -1
- package/package.json +1 -1
package/dist/sqlite/local.cjs
CHANGED
|
@@ -1154,6 +1154,16 @@ function compileFullTextSearch(table, params) {
|
|
|
1154
1154
|
const sql = `SELECT ${t}.* FROM ${fts} JOIN ${map} ON ${map}."id" = ${fts}.rowid JOIN ${t} ON ${t}."doc_id" = ${map}."doc_id" WHERE ${conditions.join(" AND ")} ORDER BY bm25(${fts}) ASC, ${t}."doc_id" ASC LIMIT ?`;
|
|
1155
1155
|
return { sql, params: sqlParams };
|
|
1156
1156
|
}
|
|
1157
|
+
var FTS5_QUERY_ERROR_SIGNATURES = [
|
|
1158
|
+
"fts5: syntax error",
|
|
1159
|
+
"unterminated string",
|
|
1160
|
+
"unknown special query",
|
|
1161
|
+
"no such column"
|
|
1162
|
+
];
|
|
1163
|
+
function isFts5QueryError(message) {
|
|
1164
|
+
const lower = message.toLowerCase();
|
|
1165
|
+
return FTS5_QUERY_ERROR_SIGNATURES.some((sig) => lower.includes(sig));
|
|
1166
|
+
}
|
|
1157
1167
|
var DISTANCE_MEASURES = /* @__PURE__ */ new Set(["EUCLIDEAN", "COSINE", "DOT_PRODUCT"]);
|
|
1158
1168
|
function toNumberArray(qv) {
|
|
1159
1169
|
if (Array.isArray(qv)) return qv;
|
|
@@ -2182,7 +2192,7 @@ function wrapLocalSearchBackend(inner, executor, rootTable) {
|
|
|
2182
2192
|
rows = await runWithSchema(() => executor.all(stmt.sql, stmt.params));
|
|
2183
2193
|
} catch (err) {
|
|
2184
2194
|
const message = err instanceof Error ? err.message : String(err);
|
|
2185
|
-
if (
|
|
2195
|
+
if (isFts5QueryError(message)) {
|
|
2186
2196
|
throw new FiregraphError(
|
|
2187
2197
|
`fullTextSearch(): invalid FTS5 query syntax \u2014 ${message}`,
|
|
2188
2198
|
"INVALID_QUERY"
|