From 2bd6b40ead1bd9db8b4f85352f69843a187e53a5 Mon Sep 17 00:00:00 2001 From: Test Date: Tue, 27 Aug 2024 20:49:57 -0700 Subject: [PATCH] temporary fix for unknown lancedb edge case --- core/indexing/LanceDbIndex.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 7c4787529..420f33eb8 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -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