GET /api/scent?project=X&q=pattern — per-region search hit counts. */
| 2910 | |
| 2911 | /* GET /api/scent?project=X&q=pattern — per-region search hit counts. */ |
| 2912 | static void handle_atlas_scent(cbm_http_conn_t *c, const cbm_http_req_t *req) { |
| 2913 | char project[256] = {0}; |
| 2914 | cbm_store_t *store = atlas_open_project(c, req, project, sizeof(project)); |
| 2915 | if (!store) |
| 2916 | return; |
| 2917 | char q[256] = {0}; |
| 2918 | cbm_http_query_param(req->query, "q", q, (int)sizeof(q)); |
| 2919 | if (strlen(q) < 2) { |
| 2920 | cbm_store_close(store); |
| 2921 | cbm_http_replyf(c, 400, g_cors_json, "{\"error\":\"q must be at least 2 characters\"}"); |
| 2922 | return; |
| 2923 | } |
| 2924 | char *json = cbm_atlas_scent_json(store, project, q); |
| 2925 | cbm_store_close(store); |
| 2926 | atlas_reply_json(c, json, 500, "{\"error\":\"scent failed\"}"); |
| 2927 | } |
| 2928 | |
| 2929 | /* GET /api/flows?project=X — ranked entry→terminal flows. */ |
| 2930 | static void handle_atlas_flows(cbm_http_conn_t *c, const cbm_http_req_t *req) { |
no test coverage detected