@@ -3024,31 +3024,14 @@ static void scan_alternation_labels(cbm_store_t *store, const char *project, con
30243024 free(copy);
30253025}
30263026
3027- static void scan_pattern_nodes(cbm_store_t *store, const char *project, int max_rows ,
3028- cbm_node_pattern_t *first, cbm_node_t **out_nodes, int *out_count) {
3027+ static void scan_pattern_nodes(cbm_store_t *store, const char *project, cbm_node_pattern_t *first ,
3028+ cbm_node_t **out_nodes, int *out_count) {
30293029 if (first->label && strchr(first->label, '|')) {
30303030 scan_alternation_labels(store, project, first->label, out_nodes, out_count);
30313031 } else if (first->label) {
30323032 cbm_store_find_nodes_by_label(store, project, first->label, out_nodes, out_count);
30333033 } else {
3034- cbm_search_params_t params = {.project = project,
3035- .min_degree = CYP_FOUND_NONE,
3036- .max_degree = CYP_FOUND_NONE,
3037- .limit = max_rows * CYP_GROWTH_10};
3038- cbm_search_output_t sout = {0};
3039- cbm_store_search(store, ¶ms, &sout);
3040- *out_count = sout.count;
3041- *out_nodes = malloc(sout.count * sizeof(cbm_node_t));
3042- for (int i = 0; i < sout.count; i++) {
3043- (*out_nodes)[i] = sout.results[i].node;
3044- sout.results[i].node.name = NULL;
3045- sout.results[i].node.project = NULL;
3046- sout.results[i].node.label = NULL;
3047- sout.results[i].node.qualified_name = NULL;
3048- sout.results[i].node.file_path = NULL;
3049- sout.results[i].node.properties_json = NULL;
3050- }
3051- cbm_store_search_free(&sout);
3034+ cbm_store_find_nodes(store, project, out_nodes, out_count);
30523035 }
30533036 /* Apply inline property filters — free rejected nodes' strings */
30543037 if (first->prop_count > 0) {
@@ -4656,7 +4639,7 @@ static int expand_additional_patterns(cbm_store_t *store, cbm_query_t *q, const
46564639
46574640 cbm_node_t *extra_nodes = NULL;
46584641 int extra_count = 0;
4659- scan_pattern_nodes(store, project, max_rows, &patn->nodes[0], &extra_nodes, &extra_count);
4642+ scan_pattern_nodes(store, project, &patn->nodes[0], &extra_nodes, &extra_count);
46604643 int rc = 0;
46614644 if (patn->rel_count == 0) {
46624645 rc = cross_join_nodes(bindings, bind_count, extra_nodes, extra_count, nvar, opt);
@@ -4708,7 +4691,7 @@ static int execute_single(cbm_store_t *store, cbm_query_t *q, const char *projec
47084691 /* Step 1: Scan initial nodes */
47094692 cbm_node_t *scanned = NULL;
47104693 int scan_count = 0;
4711- scan_pattern_nodes(store, project, max_rows, &pat0->nodes[0], &scanned, &scan_count);
4694+ scan_pattern_nodes(store, project, &pat0->nodes[0], &scanned, &scan_count);
47124695
47134696 /* Build initial bindings with early WHERE */
47144697 int bind_cap = scan_count > max_rows ? scan_count : (max_rows > 0 ? max_rows : SKIP_ONE);
0 commit comments