MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / doc_rows_of

Function doc_rows_of

tests/test_pipeline.c:22495–22525  ·  view source on GitHub ↗

The candidate count, and the bad rows, of one section (its QN contains * heading and its file ends in ext): p must be the format's curve value at * two decimals and the tfidf at or above the format's first stored band. */

Source from the content-addressed store, hash-verified

22493 * heading and its file ends in ext): p must be the format's curve value at
22494 * two decimals and the tfidf at or above the format's first stored band. */
22495static int doc_rows_of(cbm_store_t *s, const char *heading, const char *ext,
22496 cbm_sem_doc_format_t fmt, const char *forbidden_target, int *bad) {
22497 sqlite3_stmt *st = NULL;
22498 *bad = 0;
22499 if (sqlite3_prepare_v2(
22500 cbm_store_get_db(s),
22501 "SELECT c.target_qn, c.score, c.p, c.evidence FROM doc_link_candidates c "
22502 "JOIN nodes n ON n.qualified_name = c.section_qn "
22503 "WHERE instr(c.section_qn, ?1) > 0 AND n.file_path LIKE ?2",
22504 -1, &st, NULL) != SQLITE_OK) {
22505 return -1;
22506 }
22507 char like[32];
22508 snprintf(like, sizeof(like), "%%%s", ext);
22509 sqlite3_bind_text(st, 1, heading, -1, SQLITE_TRANSIENT);
22510 sqlite3_bind_text(st, 2, like, -1, SQLITE_TRANSIENT);
22511 int n = 0;
22512 while (sqlite3_step(st) == SQLITE_ROW) {
22513 const char *target = (const char *)sqlite3_column_text(st, 0);
22514 float score = (float)sqlite3_column_double(st, 1);
22515 double p = sqlite3_column_double(st, 2);
22516 bool is_function = false;
22517 double want =
22518 doc_row_want((const char *)sqlite3_column_text(st, 3), fmt, score, &is_function);
22519 *bad += want <= 0.0 || p != want ||
22520 (forbidden_target && target && strstr(target, forbidden_target));
22521 n++;
22522 }
22523 sqlite3_finalize(st);
22524 return n;
22525}
22526
22527/* Candidates never repeat an exact link: a section whose code span names a
22528 * function (a MENTIONS edge) does not also list that function as a

Callers 1

test_pipeline.cFile · 0.85

Calls 2

cbm_store_get_dbFunction · 0.85
doc_row_wantFunction · 0.85

Tested by

no test coverage detected