(scope: str = "latest", month: str = "")
| 3339 | """, |
| 3340 | [user_id, *visible_ids], |
| 3341 | ).fetchone()["count"] |
| 3342 | or 0 |
| 3343 | ) |
| 3344 | conn.close() |
| 3345 | |
| 3346 | return { |
| 3347 | **stats, |
| 3348 | "nodes": len(nodes), |
| 3349 | "nodes_by_type": by_type, |
| 3350 | "edges": edge_count, |
| 3351 | "citations": citation_count, |
| 3352 | "latest_update": latest, |
| 3353 | "wiki_dir": str(_effective_wiki_dir_for_user(user_id) or stats.get("wiki_dir") or ""), |
| 3354 | } |
| 3355 | |
| 3356 | |
| 3357 | def wiki_search(user_id: str, query: str = "", node_type: Optional[str] = None, limit: int = 12) -> Dict[str, Any]: |
| 3358 | nodes = wiki_db.search_nodes(user_id, query, node_type=node_type or None, limit=limit) |
| 3359 | filtered_nodes = _filter_wiki_nodes_for_configured_dir(nodes) |
| 3360 | if filtered_nodes is not None: |
| 3361 | nodes = filtered_nodes |
| 3362 | nodes = sorted(nodes, key=_wiki_display_priority) |
| 3363 | return { |
| 3364 | "nodes": [ |
| 3365 | { |
| 3366 | "node_id": node.get("node_id"), |
| 3367 | "node_type": node.get("node_type"), |
| 3368 | "title": node.get("title"), |
| 3369 | "body": str(node.get("body") or "")[:800], |
| 3370 | "keywords": node.get("keywords"), |
no test coverage detected