You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: global-template/docgen/lib/context.mjs
+8-19Lines changed: 8 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -18,34 +18,23 @@ function ftsQuery(value) {
18
18
functionrowsForFacts(db,query,limit){
19
19
constmatch=ftsQuery(query);
20
20
if(!match)returndb.prepare('SELECT id,kind,name,path,line,statement,snippet,metadata,content_hash FROM facts ORDER BY path,line LIMIT ?').all(limit);
21
-
try{
22
-
returndb.prepare(`SELECT f.id,f.kind,f.name,f.path,f.line,f.statement,f.snippet,f.metadata,f.content_hash,bm25(facts_fts) score FROM facts_fts JOIN facts f ON f.id=facts_fts.id WHERE facts_fts MATCH ? ORDER BY score LIMIT ?`).all(match,limit);
23
-
}catch{
24
-
returndb.prepare('SELECT id,kind,name,path,line,statement,snippet,metadata,content_hash FROM facts WHERE lower(name||\' \'||statement||\' \'||path) LIKE ? LIMIT ?').all(`%${String(query).toLowerCase().split(/\s+/)[0]??''}%`,limit);
25
-
}
21
+
try{returndb.prepare(`SELECT f.id,f.kind,f.name,f.path,f.line,f.statement,f.snippet,f.metadata,f.content_hash,bm25(facts_fts) score FROM facts_fts JOIN facts f ON f.id=facts_fts.id WHERE facts_fts MATCH ? ORDER BY score LIMIT ?`).all(match,limit);}
22
+
catch{returndb.prepare('SELECT id,kind,name,path,line,statement,snippet,metadata,content_hash FROM facts WHERE lower(name||\' \'||statement||\' \'||path) LIKE ? LIMIT ?').all(`%${String(query).toLowerCase().split(/\s+/)[0]??''}%`,limit);}
26
23
}
27
24
28
25
functionrowsForModels(db,query,limit){
29
26
constmatch=ftsQuery(query);
30
27
if(!match)returndb.prepare('SELECT id,model,kind,name,statement,classification,confidence,evidence,payload,content_hash FROM model_items LIMIT ?').all(limit);
31
-
try{
32
-
returndb.prepare(`SELECT m.id,m.model,m.kind,m.name,m.statement,m.classification,m.confidence,m.evidence,m.payload,m.content_hash,bm25(model_fts) score FROM model_fts JOIN model_items m ON m.id=model_fts.id WHERE model_fts MATCH ? ORDER BY score LIMIT ?`).all(match,limit);
33
-
}catch{return[];}
28
+
try{returndb.prepare(`SELECT m.id,m.model,m.kind,m.name,m.statement,m.classification,m.confidence,m.evidence,m.payload,m.content_hash,bm25(model_fts) score FROM model_fts JOIN model_items m ON m.id=model_fts.id WHERE model_fts MATCH ? ORDER BY score LIMIT ?`).all(match,limit);}
0 commit comments