code wiki / (root) / nx_queries_merge.nx

nx_queries_merge.nx

buildroot/runtime/nx_queries_merge.nx

1995 B31 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_queries_merge.nx -- REWRITE ENSEMBLE AS TERM UNION (search R0l+, 2026-09-16): join K BEIR query files row by row into ONE queries file whose text is the space-joined union of every file's text for that query id. WHY. Every reasoning rewrite of a query is one sample of the vocabulary the answer lives in; two rewrites of the same query from different engines or seeds cover different terms. With the BM25Q query-term saturation already in nx_beir_eval (S5), the union of K rewrites scores as one long query whose repeated terms saturate instead of piling up, so a K-rewrite ensemble needs NO evaluator change: it is a queries file. This organ makes that file, and nothing else (rank fusion of the K rankings is the next arm, and it lives in the evaluator when it comes). CONTRACT. Every input carries the same query ids in the same order (the rewrite driver preserves the split's order), and the organ REFUSES BY NAME on the first row whose id differs or on a row-count mismatch -- a silently misaligned merge would score one query's rewrite against another's judgments and look like a real number. The output is truncate-written to <out>.tmp and renamed, so a killed run leaves no half file. nx_queries_merge <out.tsv> <in1.tsv> <in2.tsv> [<in3.tsv> ...] exit 0 MERGED / 2 usage / 3 REFUSED (mismatch named) / 4 io license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_queries_merge_lib.nx nx_queries_merge.nx

imports: nx_syscalls.nxnx_queries_merge_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main qm_puts qm_slen sys_write sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ qm_merge sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close qm_count_rows qm_row_at qm_ids_equal qm_cat sys_openat_wr qm_write_all sys_write ↻ sys_close ↻ sys_renameat qm_report qm_puts ↻ qm_putn

structs

none

consts

none

functions

20func main(argc: i64, argv: *i64) -> i64