|
|
@@ -619,7 +619,7 @@ export type Store = {
|
|
|
|
|
|
// Search
|
|
|
searchFTS: (query: string, limit?: number, collectionId?: number) => SearchResult[];
|
|
|
- searchVec: (query: string, model: string, limit?: number, collectionId?: number) => Promise<SearchResult[]>;
|
|
|
+ searchVec: (query: string, model: string, limit?: number, collectionName?: string) => Promise<SearchResult[]>;
|
|
|
|
|
|
// Query expansion & reranking
|
|
|
expandQuery: (query: string, model?: string) => Promise<string[]>;
|
|
|
@@ -702,7 +702,7 @@ export function createStore(dbPath?: string): Store {
|
|
|
|
|
|
// Search
|
|
|
searchFTS: (query: string, limit?: number, collectionId?: number) => searchFTS(db, query, limit, collectionId),
|
|
|
- searchVec: (query: string, model: string, limit?: number, collectionId?: number) => searchVec(db, query, model, limit, collectionId),
|
|
|
+ searchVec: (query: string, model: string, limit?: number, collectionName?: string) => searchVec(db, query, model, limit, collectionName),
|
|
|
|
|
|
// Query expansion & reranking
|
|
|
expandQuery: (query: string, model?: string) => expandQuery(query, model, db),
|
|
|
@@ -1900,7 +1900,7 @@ export function searchFTS(db: Database, query: string, limit: number = 20, colle
|
|
|
// Vector Search
|
|
|
// =============================================================================
|
|
|
|
|
|
-export async function searchVec(db: Database, query: string, model: string, limit: number = 20, collectionId?: number): Promise<SearchResult[]> {
|
|
|
+export async function searchVec(db: Database, query: string, model: string, limit: number = 20, collectionName?: string): Promise<SearchResult[]> {
|
|
|
const tableExists = db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='vectors_vec'`).get();
|
|
|
if (!tableExists) return [];
|
|
|
|
|
|
@@ -1943,9 +1943,9 @@ export async function searchVec(db: Database, query: string, model: string, limi
|
|
|
`;
|
|
|
const params: string[] = [...hashSeqs];
|
|
|
|
|
|
- if (collectionId) {
|
|
|
+ if (collectionName) {
|
|
|
docSql += ` AND d.collection = ?`;
|
|
|
- params.push(String(collectionId));
|
|
|
+ params.push(collectionName);
|
|
|
}
|
|
|
|
|
|
const docRows = db.prepare(docSql).all(...params) as {
|