fix: add configSchema to openclaw.plugin.json, add search CLI command, fix total_docs stat
- Add required configSchema to openclaw.plugin.json for OpenClaw plugin discovery - Add search command to CLI with --limit, --dir, --from-date, --to-date, --tags filters - Fix get_stats() to properly count unique docs (was returning 0 for non-null values) - Remove hardcoded max_results default of 5; search now returns all results by default - Update INSTALL.md and design docs with correct OpenClaw extension path instructions
This commit is contained in:
@@ -74,7 +74,7 @@ export async function searchVectorDb(
|
||||
}
|
||||
const whereClause = conditions.length > 0 ? conditions.join(" AND ") : undefined;
|
||||
|
||||
const limit = options.max_results ?? 5;
|
||||
const limit = options.max_results;
|
||||
|
||||
// Try vector search first; if Ollama is down embedQuery throws → fallback to FTS
|
||||
let rows: Record<string, unknown>[];
|
||||
@@ -85,14 +85,20 @@ export async function searchVectorDb(
|
||||
if (whereClause) {
|
||||
queryBuilder = queryBuilder.filter(whereClause);
|
||||
}
|
||||
rows = await queryBuilder.limit(limit).toArray();
|
||||
if (limit !== undefined) {
|
||||
queryBuilder = queryBuilder.limit(limit);
|
||||
}
|
||||
rows = await queryBuilder.toArray();
|
||||
} catch {
|
||||
// Ollama unavailable — fallback to full-text search on chunk_text (BM25 scoring)
|
||||
let ftsBuilder = table.query().fullTextSearch(query);
|
||||
if (whereClause) {
|
||||
ftsBuilder = ftsBuilder.filter(whereClause);
|
||||
}
|
||||
rows = await ftsBuilder.limit(limit).toArray();
|
||||
if (limit !== undefined) {
|
||||
ftsBuilder = ftsBuilder.limit(limit);
|
||||
}
|
||||
rows = await ftsBuilder.toArray();
|
||||
}
|
||||
|
||||
return rows.map((r: Record<string, unknown>) => ({
|
||||
|
||||
Reference in New Issue
Block a user