temporary fix for unknown lancedb edge case

This commit is contained in:
Test 2024-08-27 20:49:57 -07:00
parent 6d15e14893
commit 2bd6b40ead

View file

@ -12,6 +12,7 @@ import {
} from "../index.js";
import { getBasename } from "../util/index.js";
import { getLanceDbPath, migrate } from "../util/paths.js";
import { Telemetry } from "../util/posthog.js";
import { chunkDocument, shouldChunk } from "./chunk/chunk.js";
import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js";
import {
@ -417,6 +418,15 @@ export class LanceDbIndex implements CodebaseIndex {
return [];
}
if (!db.search) {
// Unclear why this is happening
console.debug(
"Error retrieving from vectordb: db.search isn't a function",
);
Telemetry.capture("db_search_not_a_function", {}, false);
return [];
}
let query = db.search(vector);
if (directory) {
// seems like lancedb is only post-filtering, so have to return a bunch of results and slice after