Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

perf(knn): exact scan ranks from vector columns, hydrates only winners (#1091)

Vincenzo Lombardoe3a935710b1d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d7721534..bcb635fd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Performance
+
+- **Exact semantic/kNN scans on passage-chunked corpora no longer re-parse every stored
+ document per query** (issue [#1091](https://github.com/xerj-org/xerj/issues/1091)) — a
+ `semantic_text` field whose documents carry passage vectors stays on the exact scan by design
+ (309f0b6f), and that scan parsed each segment's stored documents (vectors included, ~53 KB a
+ document on FiQA) to read two fields per candidate; they overflowed the hydration budget, the
+ RSS spike tripped the memory-watermark drain, and every query paid the whole decode again. An
+ unfiltered scan now ranks from per-segment vector columns that also carry `_id`/`_seq_no`,
+ builds a missing column from the stored section's typed kNN projection (no `_source`
+ reconstructed), and hydrates only the ranked winners row-selectively — without the generated
+ embedding companions when the default `_source` would drop them anyway. Answers are unchanged
+ (bit-identical scores against the existing clone-everything oracle; 50/50 identical ranked
+ ids on FiQA). FiQA, 57,638 docs, lexical embedder, same machine: `semantic` p50 3,865 →
+ 261 ms, `hybrid` p50 5,772 → 289 ms, memory-watermark crossings 25 → 0
+ (`benchmarks/beir-hybrid/results/2026-10-07-issue-1091/`). Filtered and `scalar8` scans keep
+ the stored-document path; a segment stored as LZ4 (under 128 documents) still builds its column
+ and hydrates its winners from parsed documents.
+
## [1.0.0-rc.88] - 2026-10-07
### Added
diff --git a/benchmarks/beir-hybrid/latency_1091.py b/benchmarks/beir-hybrid/latency_1091.py
new file mode 100644
index 000000000..e1cba5069
--- /dev/null
+++ b/benchmarks/beir-hybrid/latency_1091.py
@@ -0,0 +1,88 @@
+"""Issue #1091: per-query wall time of the semantic and hybrid first stages.
+
+Runs the first N BEIR queries (in file order) against an index loaded by
+load.py, once each, cache-off, as a `semantic` query and as the same `hybrid`
+(BM25 + semantic, RRF) body judge_gate.py sends. Writes every query's wall
+time and returned ids to a JSON file so two builds can be compared both for
+speed and for identical answers.
+
+ python3 latency_1091.py run <url> <index> <queries.jsonl> <n> <out.json> <expected_docs>
+ python3 latency_1091.py diff <before.json> <after.json>
+"""
+import json
+import sys
+import time
+import urllib.request
+
+
+def post(url, index, body):
+ req = urllib.request.Request(
+ f"{url}/{index}/_search?request_cache=false",
+ data=json.dumps(body).encode(),
+ headers={"content-type": "application/json"},
+ )
+ started = time.time()
+ res = json.loads(urllib.request.urlopen(req, timeout=600).read())
+ return (time.time() - started) * 1000.0, [h["_id"] for h in res["hits"]["hits"]]
+
+
+def bm25(q):
+ return {"multi_match": {"query": q, "fields": ["title", "text"]}}
+
+
+def sem(q):
+ return {"semantic": {"field": "body", "query": q}}
+
+
+ARMS = {
+ "semantic": lambda q: {"size": 30, "query": sem(q)},
+ "hybrid": lambda q: {
+ "size": 30,
+ "query": {"hybrid": {"queries": [{"query": bm25(q)}, {"query": sem(q)}], "fusion": "rrf"}},
+ },
+}
+
+
+def pct(values, p):
+ ordered = sorted(values)
+ return ordered[min(len(ordered) - 1, int(round(p * (len(ordered) - 1))))]
+
+
+def run(url, index, queries_path, n, out_path, expected_docs):
+ count = json.loads(urllib.request.urlopen(f"{url}/{index}/_count").read())["count"]
+ if count != expected_docs:
+ sys.exit(f"{index} holds {count} documents, expected {expected_docs}: reload before measuring")
+ queries = [json.loads(line)["text"] for line in open(queries_path)][:n]
+ out = {}
+ for arm, body in ARMS.items():
+ rows = []
+ for q in queries:
+ wall, ids = post(url, index, body(q))
+ rows.append({"q": q, "wall_ms": wall, "ids": ids})
+ walls = [r["wall_ms"] for r in rows]
+ # The first request of the first arm pays any cold per-segment work.
+ print(
+ f"{arm:9s} n={len(rows)} first={walls[0]:.0f}ms "
+ f"p50={pct(walls[1:], 0.5):.0f}ms p95={pct(walls[1:], 0.95):.0f}ms "
+ f"max={max(walls[1:]):.0f}ms (p50/p95/max exclude the first)"
+ )
+ out[arm] = rows
+ json.dump(out, open(out_path, "w"), indent=1)
+
+
+def diff(before_path, after_path):
+ before, after = json.load(open(before_path)), json.load(open(after_path))
+ for arm in ARMS:
+ pairs = list(zip(before[arm], after[arm]))
+ same = sum(b["ids"] == a["ids"] for b, a in pairs)
+ print(f"{arm:9s} identical ranked ids: {same}/{len(pairs)}")
+ for b, a in pairs:
+ if b["ids"] != a["ids"]:
+ print(f" differs: {b['q'][:60]!r}")
+
+
+if __name__ == "__main__":
+ if sys.argv[1] == "run":
+ run(sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5]), sys.argv[6], int(sys.argv[7]))
+ else:
+ diff(sys.argv[2], sys.argv[3])
diff --git a/benchmarks/beir-hybrid/load.py b/benchmarks/beir-hybrid/load.py
index e0c42051f..82aa88af7 100644
--- a/benchmarks/beir-hybrid/load.py
+++ b/benchmarks/beir-hybrid/load.py
@@ -1,4 +1,4 @@
-import json, urllib.request, sys
+import json, urllib.request, sys, time
import os
U=os.environ.get("XERJ_URL","http://localhost:9410")
def req(m,p,b=None,ct="application/json"):
@@ -18,7 +18,16 @@ for i in range(0,len(docs),B):
for d in docs[i:i+B]:
lines.append(json.dumps({"index":{"_index":DS,"_id":d["_id"]}}))
lines.append(json.dumps({"title":d["title"],"text":d["text"],"body":(d["title"]+". "+d["text"])}))
- r=req("POST","/_bulk",("\n".join(lines)+"\n").encode(),"application/x-ndjson")
+ body=("\n".join(lines)+"\n").encode()
+ # A 429 — whole request or per item — is the node's memory breaker asking
+ # the writer to wait (#1091's A/B lost a third of FiQA to one). The batch
+ # carries fixed _ids, so resending it is idempotent; anything else stops.
+ for attempt in range(60):
+ r=req("POST","/_bulk",body,"application/x-ndjson")
+ throttled=r.get("_err")==429 or (r.get("errors") and any(
+ next(iter(it.values())).get("status")==429 for it in r.get("items",[])))
+ if not throttled: break
+ time.sleep(5)
if r.get("errors") or "_err" in r: print("bulk problem",str(r)[:300]); break
if i%1000==0: print("indexed",i,flush=True)
print(req("POST","/"+DS+"/_refresh")); print(req("GET","/"+DS+"/_count"))
diff --git a/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/ab.log b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/ab.log
new file mode 100644
index 000000000..ab27b2f31
--- /dev/null
+++ b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/ab.log
@@ -0,0 +1,18 @@
+== baseline e4c6c027
+xerj v1.0.0-rc.87
+{'count': 57638, '_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0}}
+semantic n=50 first=7164ms p50=3865ms p95=6398ms max=6987ms (p50/p95/max exclude the first)
+hybrid n=50 first=10708ms p50=5772ms p95=7368ms max=9355ms (p50/p95/max exclude the first)
+watermark crossings: 25
+== fix
+xerj v1.0.0-rc.87
+{'count': 57638, '_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0}}
+semantic n=50 first=8511ms p50=261ms p95=293ms max=305ms (p50/p95/max exclude the first)
+hybrid n=50 first=377ms p50=289ms p95=330ms max=344ms (p50/p95/max exclude the first)
+watermark crossings: 0
+semantic identical ranked ids: 50/50
+hybrid identical ranked ids: 50/50
+0
+AB_DONE
+
+[exited with code 0]
diff --git a/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/baseline-e4c6c027.json b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/baseline-e4c6c027.json
new file mode 100644
index 000000000..951801dde
--- /dev/null
+++ b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/baseline-e4c6c027.json
@@ -0,0 +1,2606 @@
+{
+ "semantic": [
+ {
+ "q": "What is considered a business expense on a business trip?",
+ "wall_ms": 7163.672924041748,
+ "ids": [
+ "429555",
+ "351672",
+ "338700",
+ "289620",
+ "308472",
+ "231449",
+ "192516",
+ "538208",
+ "327002",
+ "348480"
+ ]
+ },
+ {
+ "q": "Business Expense - Car Insurance Deductible For Accident That Occurred During a Business Trip",
+ "wall_ms": 6397.976636886597,
+ "ids": [
+ "562777",
+ "360361",
+ "397608",
+ "327002",
+ "351672",
+ "434619",
+ "97719",
+ "274721",
+ "289620",
+ "153377"
+ ]
+ },
+ {
+ "q": "Starting a new online business",
+ "wall_ms": 6362.361192703247,
+ "ids": [
+ "429555",
+ "428471",
+ "444444",
+ "399762",
+ "143499",
+ "584232",
+ "90290",
+ "483942",
+ "282958",
+ "64899"
+ ]
+ },
+ {
+ "q": "\u201cBusiness day\u201d and \u201cdue date\u201d for bills",
+ "wall_ms": 6244.757890701294,
+ "ids": [
+ "47957",
+ "41214",
+ "99986",
+ "434266",
+ "162389",
+ "14461",
+ "438103",
+ "19694",
+ "396662",
+ "524878"
+ ]
+ },
+ {
+ "q": "New business owner - How do taxes work for the business vs individual?",
+ "wall_ms": 6032.783985137939,
+ "ids": [
+ "338700",
+ "476562",
+ "563025",
+ "8163",
+ "426343",
+ "143728",
+ "390368",
+ "160859",
+ "538208",
+ "429555"
+ ]
+ },
+ {
+ "q": "Hobby vs. Business",
+ "wall_ms": 6133.300065994263,
+ "ids": [
+ "153377",
+ "540634",
+ "143499",
+ "444444",
+ "563025",
+ "338700",
+ "428471",
+ "419717",
+ "360361",
+ "429555"
+ ]
+ },
+ {
+ "q": "Personal checks instead of business ones",
+ "wall_ms": 6042.12212562561,
+ "ids": [
+ "400230",
+ "130631",
+ "135196",
+ "98636",
+ "390368",
+ "552216",
+ "591416",
+ "414836",
+ "97719",
+ "446870"
+ ]
+ },
+ {
+ "q": "Does U.S. tax code call for small business owners to count business purchases as personal income?",
+ "wall_ms": 6167.840957641602,
+ "ids": [
+ "541809",
+ "390368",
+ "264068",
+ "265398",
+ "234743",
+ "203820",
+ "101265",
+ "141458",
+ "64899",
+ "588327"
+ ]
+ },
+ {
+ "q": "How can I register a UK business without providing a business address?",
+ "wall_ms": 6288.665056228638,
+ "ids": [
+ "429555",
+ "348480",
+ "64899",
+ "584232",
+ "428471",
+ "537593",
+ "130631",
+ "465041",
+ "32985",
+ "196374"
+ ]
+ },
+ {
+ "q": "What are 'business fundamentals'?",
+ "wall_ms": 6301.837921142578,
+ "ids": [
+ "563025",
+ "477208",
+ "368056",
+ "433806",
+ "442347",
+ "444444",
+ "136262",
+ "547553",
+ "192516",
+ "181412"
+ ]
+ },
+ {
+ "q": "Business Investment Loss from prior year",
+ "wall_ms": 6372.462749481201,
+ "ids": [
+ "333954",
+ "51615",
+ "174025",
+ "563025",
+ "38335",
+ "389164",
+ "115274",
+ "143499",
+ "368056",
+ "153377"
+ ]
+ },
+ {
+ "q": "How can I estimate business taxes / filing fees for a business that has $0 income?",
+ "wall_ms": 6345.876932144165,
+ "ids": [
+ "429555",
+ "180690",
+ "64899",
+ "160859",
+ "338700",
+ "195207",
+ "107794",
+ "541809",
+ "480287",
+ "582429"
+ ]
+ },
+ {
+ "q": "Would the purchase of a car for a business through the use of a business loan be considered a business expense?",
+ "wall_ms": 6986.891031265259,
+ "ids": [
+ "289620",
+ "130631",
+ "444444",
+ "454526",
+ "540395",
+ "471123",
+ "538208",
+ "143728",
+ "418771",
+ "429555"
+ ]
+ },
+ {
+ "q": "Deducting last years (undocumented) side business loss",
+ "wall_ms": 5735.08620262146,
+ "ids": [
+ "581265",
+ "115274",
+ "184495",
+ "406419",
+ "368056",
+ "533808",
+ "360361",
+ "153377",
+ "574417",
+ "155781"
+ ]
+ },
+ {
+ "q": "30% share in business",
+ "wall_ms": 5410.415887832642,
+ "ids": [
+ "563025",
+ "336468",
+ "428471",
+ "143499",
+ "484414",
+ "444444",
+ "545964",
+ "360361",
+ "338700",
+ "584232"
+ ]
+ },
+ {
+ "q": "Claiming business expense from personal credit card",
+ "wall_ms": 3922.790288925171,
+ "ids": [
+ "336468",
+ "425487",
+ "354716",
+ "6341",
+ "447738",
+ "381151",
+ "388076",
+ "397608",
+ "423569",
+ "519644"
+ ]
+ },
+ {
+ "q": "Using business check to pay at retail",
+ "wall_ms": 3901.366949081421,
+ "ids": [
+ "397186",
+ "32066",
+ "435825",
+ "267121",
+ "456373",
+ "203820",
+ "172518",
+ "444444",
+ "279480",
+ "408308"
+ ]
+ },
+ {
+ "q": "Tax whilst starting a business in full time employment",
+ "wall_ms": 3932.7831268310547,
+ "ids": [
+ "6568",
+ "282958",
+ "43370",
+ "10717",
+ "444444",
+ "429555",
+ "141458",
+ "193367",
+ "82627",
+ "413209"
+ ]
+ },
+ {
+ "q": "Can I pay off my credit card balance to free up available credit?",
+ "wall_ms": 3909.16109085083,
+ "ids": [
+ "65537",
+ "423505",
+ "499180",
+ "292038",
+ "81206",
+ "425352",
+ "273528",
+ "403934",
+ "188406",
+ "467581"
+ ]
+ },
+ {
+ "q": "Starting a side business slowly",
+ "wall_ms": 3885.0860595703125,
+ "ids": [
+ "429555",
+ "590775",
+ "444444",
+ "175072",
+ "348480",
+ "419717",
+ "29886",
+ "192516",
+ "155781",
+ "132780"
+ ]
+ },
+ {
+ "q": "Why is \u201ccheque cashing\u201d a legitimate business?",
+ "wall_ms": 3863.476037979126,
+ "ids": [
+ "155781",
+ "429555",
+ "338700",
+ "360361",
+ "351672",
+ "471316",
+ "563025",
+ "518205",
+ "584232",
+ "538208"
+ ]
+ },
+ {
+ "q": "Is business the only way to become a millionaire?",
+ "wall_ms": 3874.825954437256,
+ "ids": [
+ "229110",
+ "425387",
+ "539752",
+ "143728",
+ "23408",
+ "504243",
+ "508754",
+ "100764",
+ "538208",
+ "451421"
+ ]
+ },
+ {
+ "q": "Valuing a small business to invest in",
+ "wall_ms": 3864.7241592407227,
+ "ids": [
+ "444444",
+ "117427",
+ "24917",
+ "366141",
+ "259948",
+ "35810",
+ "464264",
+ "360361",
+ "141458",
+ "563025"
+ ]
+ },
+ {
+ "q": "Starting a large business with a not so large income?",
+ "wall_ms": 3864.2051219940186,
+ "ids": [
+ "429555",
+ "192516",
+ "235711",
+ "196374",
+ "237316",
+ "371515",
+ "337352",
+ "441260",
+ "422331",
+ "313361"
+ ]
+ },
+ {
+ "q": "Requirements for filing business taxes?",
+ "wall_ms": 3850.9209156036377,
+ "ids": [
+ "387573",
+ "274832",
+ "181412",
+ "248624",
+ "179420",
+ "444589",
+ "334107",
+ "336468",
+ "101265",
+ "54225"
+ ]
+ },
+ {
+ "q": "IRA for work and my business",
+ "wall_ms": 3766.129970550537,
+ "ids": [
+ "47957",
+ "86852",
+ "115274",
+ "44578",
+ "512803",
+ "354716",
+ "406130",
+ "37134",
+ "450840",
+ "368056"
+ ]
+ },
+ {
+ "q": "Advice on money transfer business",
+ "wall_ms": 3784.245014190674,
+ "ids": [
+ "475798",
+ "563025",
+ "433806",
+ "590775",
+ "488037",
+ "288074",
+ "24612",
+ "221239",
+ "237338",
+ "220682"
+ ]
+ },
+ {
+ "q": "How to transfer personal auto lease to business auto lease?",
+ "wall_ms": 3807.433843612671,
+ "ids": [
+ "13215",
+ "384994",
+ "241054",
+ "367434",
+ "324779",
+ "476219",
+ "513051",
+ "64279",
+ "516777",
+ "30970"
+ ]
+ },
+ {
+ "q": "Tutoring Business Payroll Management",
+ "wall_ms": 3935.483932495117,
+ "ids": [
+ "88346",
+ "143499",
+ "447167",
+ "115274",
+ "584232",
+ "428471",
+ "386178",
+ "444444",
+ "429555",
+ "324911"
+ ]
+ },
+ {
+ "q": "As a small business owner, should I pay my taxes from my personal or business checking account?",
+ "wall_ms": 3786.6690158843994,
+ "ids": [
+ "64556",
+ "338700",
+ "562777",
+ "537593",
+ "429555",
+ "64899",
+ "77201",
+ "471160",
+ "542213",
+ "258423"
+ ]
+ },
+ {
+ "q": "Should my husband's business pay my business?",
+ "wall_ms": 3748.216152191162,
+ "ids": [
+ "64556",
+ "537593",
+ "563025",
+ "338700",
+ "319785",
+ "428471",
+ "172518",
+ "117332",
+ "584232",
+ "440061"
+ ]
+ },
+ {
+ "q": "Why can't online transactions be completed outside of business hours?",
+ "wall_ms": 3806.056022644043,
+ "ids": [
+ "330865",
+ "120321",
+ "440061",
+ "186718",
+ "29404",
+ "576728",
+ "130631",
+ "55200",
+ "428471",
+ "410327"
+ ]
+ },
+ {
+ "q": "Full-time work + running small side business: Best business structure for taxes?",
+ "wall_ms": 3733.2067489624023,
+ "ids": [
+ "64899",
+ "8163",
+ "368056",
+ "360361",
+ "156554",
+ "336468",
+ "519473",
+ "582429",
+ "29886",
+ "204554"
+ ]
+ },
+ {
+ "q": "New vending route business, not sure how to determine taxes",
+ "wall_ms": 3794.06476020813,
+ "ids": [
+ "451457",
+ "61983",
+ "31697",
+ "124480",
+ "548836",
+ "38704",
+ "30970",
+ "459275",
+ "101265",
+ "83080"
+ ]
+ },
+ {
+ "q": "Finding a good small business CPA?",
+ "wall_ms": 3747.98321723938,
+ "ids": [
+ "90290",
+ "429555",
+ "11401",
+ "64899",
+ "29886",
+ "470549",
+ "68717",
+ "117427",
+ "155781",
+ "584232"
+ ]
+ },
+ {
+ "q": "Taxable income on full-time job + business earnings",
+ "wall_ms": 3708.8499069213867,
+ "ids": [
+ "90881",
+ "444273",
+ "390368",
+ "541809",
+ "595133",
+ "265159",
+ "244518",
+ "199785",
+ "81886",
+ "254151"
+ ]
+ },
+ {
+ "q": "How can I lookup the business associated with a FEIN?",
+ "wall_ms": 3778.1686782836914,
+ "ids": [
+ "487179",
+ "480443",
+ "55541",
+ "281732",
+ "160859",
+ "44635",
+ "566464",
+ "560398",
+ "532743",
+ "83059"
+ ]
+ },
+ {
+ "q": "Tax Allocation - Business Asset Transfer",
+ "wall_ms": 3761.976957321167,
+ "ids": [
+ "432935",
+ "150015",
+ "550345",
+ "218406",
+ "459970",
+ "286689",
+ "218064",
+ "337876",
+ "373966",
+ "322049"
+ ]
+ },
+ {
+ "q": "How to Deduct Family Health Care Premiums Under Side Business",
+ "wall_ms": 3687.5951290130615,
+ "ids": [
+ "462831",
+ "361954",
+ "174605",
+ "442347",
+ "52065",
+ "277498",
+ "481322",
+ "410226",
+ "176599",
+ "525334"
+ ]
+ },
+ {
+ "q": "Claiming car as a business expense in the UK",
+ "wall_ms": 3704.0250301361084,
+ "ids": [
+ "454526",
+ "471081",
+ "147245",
+ "397608",
+ "418771",
+ "63042",
+ "276884",
+ "338700",
+ "539752",
+ "289620"
+ ]
+ },
+ {
+ "q": "Do I need to keep paper records for my business?",
+ "wall_ms": 3739.619731903076,
+ "ids": [
+ "97719",
+ "537593",
+ "374443",
+ "263521",
+ "195207",
+ "147245",
+ "144054",
+ "435919",
+ "190856",
+ "64899"
+ ]
+ },
+ {
+ "q": "1040 Schedule A Un-Reimbursed Business Expense Reporting",
+ "wall_ms": 3665.074110031128,
+ "ids": [
+ "574417",
+ "351672",
+ "90290",
+ "429555",
+ "289620",
+ "562777",
+ "132780",
+ "409566",
+ "254151",
+ "192516"
+ ]
+ },
+ {
+ "q": "Why do banks require small businesses to open a business bank account instead of a cheaper personal one?",
+ "wall_ms": 3655.7791233062744,
+ "ids": [
+ "130631",
+ "261856",
+ "188167",
+ "364378",
+ "284351",
+ "98636",
+ "310103",
+ "464449",
+ "229546",
+ "309909"
+ ]
+ },
+ {
+ "q": "How to treat miles driven to the mechanic, gas station, etc when calculating business use of car?",
+ "wall_ms": 3676.6371726989746,
+ "ids": [
+ "307131",
+ "40257",
+ "467363",
+ "350796",
+ "380851",
+ "83504",
+ "99771",
+ "397608",
+ "295246",
+ "277498"
+ ]
+ },
+ {
+ "q": "value of guaranteeing a business loan",
+ "wall_ms": 3670.1419353485107,
+ "ids": [
+ "335543",
+ "365963",
+ "130631",
+ "119117",
+ "471123",
+ "198562",
+ "385074",
+ "436347",
+ "283733",
+ "108770"
+ ]
+ },
+ {
+ "q": "Deducting business expenses paid for by gift card",
+ "wall_ms": 3641.1798000335693,
+ "ids": [
+ "195207",
+ "537593",
+ "234743",
+ "562777",
+ "338700",
+ "83346",
+ "541809",
+ "202457",
+ "462831",
+ "204554"
+ ]
+ },
+ {
+ "q": "Car as business expense, but not because of driving",
+ "wall_ms": 3603.6009788513184,
+ "ids": [
+ "381151",
+ "397608",
+ "545087",
+ "226243",
+ "130631",
+ "475663",
+ "586488",
+ "324911",
+ "410421",
+ "69058"
+ ]
+ },
+ {
+ "q": "Can a business refuse to take credit cards?",
+ "wall_ms": 4199.655055999756,
+ "ids": [
+ "170481",
+ "352379",
+ "274721",
+ "428258",
+ "261583",
+ "421743",
+ "537593",
+ "171398",
+ "394928",
+ "6341"
+ ]
+ },
+ {
+ "q": "Calculate Estimated Tax on Hobby Business LLC",
+ "wall_ms": 5489.4859790802,
+ "ids": [
+ "444273",
+ "68969",
+ "440506",
+ "286689",
+ "387906",
+ "175951",
+ "509111",
+ "328517",
+ "334603",
+ "390368"
+ ]
+ },
+ {
+ "q": "Buying car from rental business without title",
+ "wall_ms": 6980.91197013855,
+ "ids": [
+ "66338",
+ "575172",
+ "563025",
+ "389164",
+ "298159",
+ "143499",
+ "340802",
+ "537593",
+ "397608",
+ "131177"
+ ]
+ }
+ ],
+ "hybrid": [
+ {
+ "q": "What is considered a business expense on a business trip?",
+ "wall_ms": 10707.881927490234,
+ "ids": [
+ "338700",
+ "327002",
+ "308472",
+ "429555",
+ "531578",
+ "351672",
+ "417981",
+ "216077",
+ "289620",
+ "571062",
+ "231449",
+ "531442",
+ "55200",
+ "192516",
+ "538208",
+ "104464",
+ "348480",
+ "528838",
+ "540325",
+ "562777",
+ "153377",
+ "297841",
+ "396056",
+ "73427",
+ "541809",
+ "324911",
+ "74688",
+ "560087",
+ "381151",
+ "278460"
+ ]
+ },
+ {
+ "q": "Business Expense - Car Insurance Deductible For Accident That Occurred During a Business Trip",
+ "wall_ms": 5540.764808654785,
+ "ids": [
+ "397608",
+ "562777",
+ "327002",
+ "153377",
+ "434619",
+ "97719",
+ "531578",
+ "360361",
+ "332161",
+ "390435",
+ "351672",
+ "462831",
+ "274721",
+ "540395",
+ "289620",
+ "417981",
+ "455984",
+ "447231",
+ "149210",
+ "18850",
+ "194308",
+ "40257",
+ "550345",
+ "381151",
+ "216077",
+ "272137",
+ "405356",
+ "528564",
+ "209224",
+ "354716"
+ ]
+ },
+ {
+ "q": "Starting a new online business",
+ "wall_ms": 5773.829936981201,
+ "ids": [
+ "428471",
+ "444444",
+ "115274",
+ "429555",
+ "504056",
+ "528206",
+ "398365",
+ "399762",
+ "143499",
+ "553540",
+ "480717",
+ "584232",
+ "90290",
+ "401004",
+ "56747",
+ "483942",
+ "104485",
+ "282958",
+ "64899",
+ "130598",
+ "484979",
+ "50444",
+ "331616",
+ "555430",
+ "282947",
+ "582134",
+ "237338",
+ "32345",
+ "372229",
+ "525334"
+ ]
+ },
+ {
+ "q": "\u201cBusiness day\u201d and \u201cdue date\u201d for bills",
+ "wall_ms": 5022.994041442871,
+ "ids": [
+ "14461",
+ "41214",
+ "47957",
+ "78139",
+ "560251",
+ "99986",
+ "188530",
+ "210300",
+ "434266",
+ "162389",
+ "396679",
+ "372036",
+ "36193",
+ "438103",
+ "19694",
+ "522358",
+ "382442",
+ "396662",
+ "20116",
+ "524878",
+ "152279",
+ "257841",
+ "226984",
+ "286843",
+ "25906",
+ "258439",
+ "595121",
+ "44593",
+ "564488",
+ "477720"
+ ]
+ },
+ {
+ "q": "New business owner - How do taxes work for the business vs individual?",
+ "wall_ms": 4859.15207862854,
+ "ids": [
+ "338700",
+ "8163",
+ "429555",
+ "227757",
+ "145016",
+ "476562",
+ "563025",
+ "19640",
+ "426343",
+ "588253",
+ "64899",
+ "143728",
+ "141458",
+ "390368",
+ "160859",
+ "542213",
+ "538208",
+ "219274",
+ "480717",
+ "125111",
+ "407524",
+ "128435",
+ "483664",
+ "62335",
+ "287214",
+ "262761",
+ "483385",
+ "130631",
+ "393553",
+ "538199"
+ ]
+ },
+ {
+ "q": "Hobby vs. Business",
+ "wall_ms": 5556.727170944214,
+ "ids": [
+ "153377",
+ "540634",
+ "330",
+ "283505",
+ "143499",
+ "167494",
+ "444444",
+ "563025",
+ "338700",
+ "562176",
+ "428471",
+ "525149",
+ "313361",
+ "419717",
+ "132780",
+ "360361",
+ "429555",
+ "451020",
+ "51211",
+ "25439",
+ "466442",
+ "381151",
+ "28764",
+ "278824",
+ "250498",
+ "427017",
+ "309023",
+ "32973",
+ "95441",
+ "273472"
+ ]
+ },
+ {
+ "q": "Personal checks instead of business ones",
+ "wall_ms": 5623.128175735474,
+ "ids": [
+ "400230",
+ "98636",
+ "135196",
+ "591416",
+ "552216",
+ "130631",
+ "390368",
+ "598834",
+ "8854",
+ "282103",
+ "414836",
+ "6503",
+ "97719",
+ "413229",
+ "446870",
+ "354314",
+ "438975",
+ "3763",
+ "333292",
+ "53649",
+ "399762",
+ "45519",
+ "292989",
+ "431637",
+ "64556",
+ "84645",
+ "542213",
+ "338700",
+ "576185",
+ "14466"
+ ]
+ },
+ {
+ "q": "Does U.S. tax code call for small business owners to count business purchases as personal income?",
+ "wall_ms": 5769.721984863281,
+ "ids": [
+ "588327",
+ "390368",
+ "541809",
+ "141458",
+ "264068",
+ "338700",
+ "85622",
+ "192516",
+ "265398",
+ "234743",
+ "326717",
+ "203820",
+ "519473",
+ "101265",
+ "152027",
+ "116009",
+ "64899",
+ "411063",
+ "182168",
+ "46791",
+ "192332",
+ "363495",
+ "173212",
+ "257168",
+ "412855",
+ "336468",
+ "245447",
+ "40257",
+ "334902",
+ "350819"
+ ]
+ },
+ {
+ "q": "How can I register a UK business without providing a business address?",
+ "wall_ms": 5493.6888217926025,
+ "ids": [
+ "348480",
+ "429555",
+ "507811",
+ "86852",
+ "48840",
+ "64899",
+ "315516",
+ "584232",
+ "428471",
+ "442425",
+ "245011",
+ "537593",
+ "130631",
+ "439109",
+ "310103",
+ "465041",
+ "32985",
+ "268257",
+ "196374",
+ "266229",
+ "272574",
+ "295624",
+ "562176",
+ "248629",
+ "200023",
+ "380972",
+ "106007",
+ "122986",
+ "370334",
+ "164427"
+ ]
+ },
+ {
+ "q": "What are 'business fundamentals'?",
+ "wall_ms": 5424.631118774414,
+ "ids": [
+ "398960",
+ "563025",
+ "350497",
+ "477208",
+ "368056",
+ "509659",
+ "433806",
+ "546115",
+ "442347",
+ "558539",
+ "385949",
+ "444444",
+ "136262",
+ "507829",
+ "151442",
+ "547553",
+ "11148",
+ "192516",
+ "181412",
+ "490899",
+ "5054",
+ "436557",
+ "198609",
+ "380672",
+ "70185",
+ "248217",
+ "524513",
+ "296401",
+ "361929",
+ "50119"
+ ]
+ },
+ {
+ "q": "Business Investment Loss from prior year",
+ "wall_ms": 5567.560911178589,
+ "ids": [
+ "51615",
+ "333954",
+ "128045",
+ "202114",
+ "174025",
+ "330269",
+ "194319",
+ "563025",
+ "38335",
+ "490176",
+ "381120",
+ "389164",
+ "115274",
+ "266898",
+ "143499",
+ "362060",
+ "298387",
+ "368056",
+ "153377",
+ "193485",
+ "487256",
+ "107794",
+ "261224",
+ "454082",
+ "426343",
+ "375929",
+ "14255",
+ "169240",
+ "520080",
+ "128861"
+ ]
+ },
+ {
+ "q": "How can I estimate business taxes / filing fees for a business that has $0 income?",
+ "wall_ms": 5607.625961303711,
+ "ids": [
+ "308113",
+ "429555",
+ "180690",
+ "248629",
+ "64899",
+ "208989",
+ "153541",
+ "160859",
+ "338700",
+ "533808",
+ "195207",
+ "254158",
+ "66492",
+ "107794",
+ "69306",
+ "541809",
+ "303078",
+ "480287",
+ "133235",
+ "582429",
+ "502875",
+ "523564",
+ "490489",
+ "444589",
+ "313012",
+ "117877",
+ "561750",
+ "344340",
+ "258611",
+ "132780"
+ ]
+ },
+ {
+ "q": "Would the purchase of a car for a business through the use of a business loan be considered a business expense?",
+ "wall_ms": 6175.343751907349,
+ "ids": [
+ "540395",
+ "130631",
+ "73427",
+ "289620",
+ "97719",
+ "397608",
+ "444444",
+ "454526",
+ "327002",
+ "338700",
+ "471123",
+ "447231",
+ "538208",
+ "143728",
+ "390435",
+ "418771",
+ "541809",
+ "363495",
+ "429555",
+ "85622",
+ "40257",
+ "245447",
+ "427884",
+ "268747",
+ "216077",
+ "404726",
+ "571062",
+ "474795",
+ "531442",
+ "540325"
+ ]
+ },
+ {
+ "q": "Deducting last years (undocumented) side business loss",
+ "wall_ms": 5714.739799499512,
+ "ids": [
+ "406419",
+ "292919",
+ "581265",
+ "330",
+ "115274",
+ "184495",
+ "362060",
+ "421301",
+ "368056",
+ "368229",
+ "57149",
+ "533808",
+ "64899",
+ "360361",
+ "19183",
+ "153377",
+ "574417",
+ "582189",
+ "155781",
+ "231183",
+ "532888",
+ "336451",
+ "262039",
+ "381151",
+ "86134",
+ "474795",
+ "293310",
+ "137517",
+ "160105",
+ "425523"
+ ]
+ },
+ {
+ "q": "30% share in business",
+ "wall_ms": 5506.353139877319,
+ "ids": [
+ "341424",
+ "563025",
+ "188220",
+ "336468",
+ "218468",
+ "428471",
+ "143499",
+ "297032",
+ "394597",
+ "484414",
+ "444444",
+ "465313",
+ "204209",
+ "545964",
+ "360361",
+ "565909",
+ "73457",
+ "338700",
+ "144033",
+ "584232",
+ "129481",
+ "420379",
+ "44666",
+ "238682",
+ "582736",
+ "535605",
+ "522040",
+ "599876",
+ "246295",
+ "445353"
+ ]
+ },
+ {
+ "q": "Claiming business expense from personal credit card",
+ "wall_ms": 5648.312091827393,
+ "ids": [
+ "354716",
+ "336468",
+ "447738",
+ "6341",
+ "381151",
+ "397608",
+ "425487",
+ "74688",
+ "274721",
+ "176284",
+ "222771",
+ "245447",
+ "388076",
+ "114494",
+ "423569",
+ "233751",
+ "519644",
+ "195207",
+ "283079",
+ "85517",
+ "268747",
+ "95860",
+ "562777",
+ "71987",
+ "399199",
+ "390435",
+ "290687",
+ "172518",
+ "470066",
+ "368679"
+ ]
+ },
+ {
+ "q": "Using business check to pay at retail",
+ "wall_ms": 5963.570117950439,
+ "ids": [
+ "2456",
+ "397186",
+ "1873",
+ "32066",
+ "274721",
+ "435825",
+ "48866",
+ "267121",
+ "165691",
+ "456373",
+ "203820",
+ "588219",
+ "172518",
+ "552216",
+ "85522",
+ "444444",
+ "279480",
+ "545722",
+ "224000",
+ "408308",
+ "17469",
+ "441568",
+ "173444",
+ "206375",
+ "586026",
+ "446870",
+ "452594",
+ "117378",
+ "361042",
+ "383188"
+ ]
+ },
+ {
+ "q": "Tax whilst starting a business in full time employment",
+ "wall_ms": 5690.781116485596,
+ "ids": [
+ "6568",
+ "223170",
+ "282958",
+ "541809",
+ "43370",
+ "223624",
+ "10717",
+ "13712",
+ "444444",
+ "528206",
+ "428533",
+ "429555",
+ "141458",
+ "398365",
+ "193367",
+ "592192",
+ "82627",
+ "367577",
+ "149291",
+ "413209",
+ "152298",
+ "119277",
+ "483489",
+ "350669",
+ "593371",
+ "450808",
+ "279636",
+ "193922",
+ "163693",
+ "446117"
+ ]
+ },
+ {
+ "q": "Can I pay off my credit card balance to free up available credit?",
+ "wall_ms": 6339.046239852905,
+ "ids": [
+ "423505",
+ "65537",
+ "403934",
+ "273528",
+ "417301",
+ "269947",
+ "499180",
+ "292038",
+ "487621",
+ "81206",
+ "330049",
+ "425352",
+ "509075",
+ "113167",
+ "188406",
+ "121233",
+ "467581",
+ "13656",
+ "21576",
+ "11719",
+ "589543",
+ "513256",
+ "143844",
+ "551175",
+ "321199",
+ "565856",
+ "524149",
+ "321136",
+ "287157",
+ "277590"
+ ]
+ },
+ {
+ "q": "Starting a side business slowly",
+ "wall_ms": 6014.690637588501,
+ "ids": [
+ "590775",
+ "444444",
+ "398365",
+ "429555",
+ "181624",
+ "553009",
+ "175072",
+ "391590",
+ "202208",
+ "348480",
+ "349692",
+ "419717",
+ "29886",
+ "68302",
+ "192516",
+ "155781",
+ "239459",
+ "132780",
+ "198591",
+ "480121",
+ "55499",
+ "384409",
+ "283615",
+ "19113",
+ "109383",
+ "483305",
+ "516056",
+ "528206",
+ "184495",
+ "407672"
+ ]
+ },
+ {
+ "q": "Why is \u201ccheque cashing\u201d a legitimate business?",
+ "wall_ms": 6272.5160121917725,
+ "ids": [
+ "338700",
+ "360361",
+ "155781",
+ "220644",
+ "213081",
+ "429555",
+ "212713",
+ "16774",
+ "153505",
+ "351672",
+ "471316",
+ "525803",
+ "86852",
+ "563025",
+ "518205",
+ "590102",
+ "301833",
+ "584232",
+ "449082",
+ "538208",
+ "400947",
+ "261856",
+ "84645",
+ "65404",
+ "45185",
+ "475054",
+ "244445",
+ "456636",
+ "69623",
+ "377853"
+ ]
+ },
+ {
+ "q": "Is business the only way to become a millionaire?",
+ "wall_ms": 5772.083044052124,
+ "ids": [
+ "425387",
+ "229110",
+ "402230",
+ "434972",
+ "539752",
+ "36482",
+ "143728",
+ "23408",
+ "254638",
+ "11675",
+ "504243",
+ "323873",
+ "508754",
+ "100764",
+ "597880",
+ "41960",
+ "538208",
+ "434869",
+ "451421",
+ "1099",
+ "448816",
+ "556359",
+ "227072",
+ "443097",
+ "351926",
+ "139058",
+ "148681",
+ "95200",
+ "519798",
+ "70075"
+ ]
+ },
+ {
+ "q": "Valuing a small business to invest in",
+ "wall_ms": 6146.558046340942,
+ "ids": [
+ "117427",
+ "444444",
+ "50735",
+ "161162",
+ "24917",
+ "72276",
+ "366141",
+ "546108",
+ "259948",
+ "568196",
+ "35810",
+ "72510",
+ "259227",
+ "464264",
+ "360361",
+ "441384",
+ "141458",
+ "163621",
+ "563025",
+ "593556",
+ "535300",
+ "62244",
+ "430890",
+ "567479",
+ "72131",
+ "320471",
+ "471247",
+ "179042",
+ "454526",
+ "91076"
+ ]
+ },
+ {
+ "q": "Starting a large business with a not so large income?",
+ "wall_ms": 6145.36714553833,
+ "ids": [
+ "429555",
+ "87480",
+ "192516",
+ "560393",
+ "235711",
+ "545419",
+ "196374",
+ "460353",
+ "237316",
+ "287214",
+ "153375",
+ "371515",
+ "206140",
+ "337352",
+ "441260",
+ "487929",
+ "422331",
+ "499163",
+ "313361",
+ "423416",
+ "325906",
+ "335136",
+ "436729",
+ "322906",
+ "232377",
+ "338700",
+ "85028",
+ "423083",
+ "514697",
+ "512304"
+ ]
+ },
+ {
+ "q": "Requirements for filing business taxes?",
+ "wall_ms": 5783.87713432312,
+ "ids": [
+ "248624",
+ "387573",
+ "446190",
+ "84528",
+ "274832",
+ "181412",
+ "308113",
+ "294123",
+ "158136",
+ "179420",
+ "248629",
+ "444589",
+ "334107",
+ "425804",
+ "153541",
+ "336468",
+ "101265",
+ "366761",
+ "54225",
+ "447940",
+ "43350",
+ "107584",
+ "475410",
+ "370542",
+ "595121",
+ "221281",
+ "223170",
+ "360925",
+ "333681",
+ "249322"
+ ]
+ },
+ {
+ "q": "IRA for work and my business",
+ "wall_ms": 6291.780948638916,
+ "ids": [
+ "47957",
+ "151544",
+ "86852",
+ "294644",
+ "115274",
+ "248536",
+ "44578",
+ "277810",
+ "236348",
+ "512803",
+ "192857",
+ "354716",
+ "104934",
+ "406130",
+ "37134",
+ "196961",
+ "372014",
+ "450840",
+ "368056",
+ "463182",
+ "110114",
+ "332113",
+ "447482",
+ "569953",
+ "410453",
+ "542414",
+ "163865",
+ "64899",
+ "216243",
+ "345282"
+ ]
+ },
+ {
+ "q": "Advice on money transfer business",
+ "wall_ms": 6175.479888916016,
+ "ids": [
+ "288074",
+ "24612",
+ "475798",
+ "483305",
+ "563025",
+ "589718",
+ "433806",
+ "469776",
+ "30935",
+ "590775",
+ "212312",
+ "488037",
+ "352927",
+ "150903",
+ "199808",
+ "221239",
+ "237338",
+ "562007",
+ "220682",
+ "564129",
+ "535918",
+ "150450",
+ "514968",
+ "71987",
+ "589692",
+ "426518",
+ "333616",
+ "122986",
+ "447828",
+ "343872"
+ ]
+ },
+ {
+ "q": "How to transfer personal auto lease to business auto lease?",
+ "wall_ms": 5844.050884246826,
+ "ids": [
+ "13215",
+ "179891",
+ "67663",
+ "384994",
+ "34626",
+ "241054",
+ "284610",
+ "367434",
+ "324779",
+ "440806",
+ "311748",
+ "476219",
+ "265904",
+ "513051",
+ "64279",
+ "292982",
+ "182192",
+ "516777",
+ "30970",
+ "343961",
+ "145276",
+ "205742",
+ "314050",
+ "438463",
+ "390435",
+ "256981",
+ "116643",
+ "118280",
+ "398141",
+ "489277"
+ ]
+ },
+ {
+ "q": "Tutoring Business Payroll Management",
+ "wall_ms": 5810.6369972229,
+ "ids": [
+ "386178",
+ "88346",
+ "190485",
+ "143499",
+ "369993",
+ "164040",
+ "447167",
+ "115274",
+ "372666",
+ "123693",
+ "584232",
+ "184698",
+ "428471",
+ "589398",
+ "444444",
+ "484968",
+ "18647",
+ "429555",
+ "324911",
+ "476980",
+ "388856",
+ "385320",
+ "436701",
+ "388078",
+ "582104",
+ "311704",
+ "240323",
+ "302722",
+ "510148",
+ "532839"
+ ]
+ },
+ {
+ "q": "As a small business owner, should I pay my taxes from my personal or business checking account?",
+ "wall_ms": 5399.988174438477,
+ "ids": [
+ "537593",
+ "542213",
+ "338700",
+ "64899",
+ "64556",
+ "562777",
+ "77201",
+ "547301",
+ "374443",
+ "357938",
+ "429555",
+ "177946",
+ "413229",
+ "146317",
+ "471160",
+ "227757",
+ "19640",
+ "258423",
+ "83346",
+ "297965",
+ "98636",
+ "393553",
+ "334393",
+ "309909",
+ "591416",
+ "8163",
+ "400230",
+ "135196",
+ "396792",
+ "86852"
+ ]
+ },
+ {
+ "q": "Should my husband's business pay my business?",
+ "wall_ms": 5973.185062408447,
+ "ids": [
+ "319785",
+ "537593",
+ "64556",
+ "571143",
+ "193367",
+ "322838",
+ "563025",
+ "338700",
+ "592192",
+ "374443",
+ "428471",
+ "172518",
+ "568512",
+ "117332",
+ "352640",
+ "109250",
+ "584232",
+ "440061",
+ "477208",
+ "22193",
+ "444589",
+ "272279",
+ "572774",
+ "83059",
+ "290113",
+ "97719",
+ "367754",
+ "107584",
+ "134902",
+ "155193"
+ ]
+ },
+ {
+ "q": "Why can't online transactions be completed outside of business hours?",
+ "wall_ms": 5347.770214080811,
+ "ids": [
+ "120321",
+ "309171",
+ "330865",
+ "65227",
+ "440061",
+ "2565",
+ "186718",
+ "29404",
+ "157518",
+ "576728",
+ "580935",
+ "130631",
+ "277964",
+ "55200",
+ "461009",
+ "241444",
+ "428471",
+ "304662",
+ "410327",
+ "448110",
+ "376170",
+ "397510",
+ "338096",
+ "176061",
+ "73797",
+ "417133",
+ "163522",
+ "374451",
+ "182255",
+ "86929"
+ ]
+ },
+ {
+ "q": "Full-time work + running small side business: Best business structure for taxes?",
+ "wall_ms": 5262.182712554932,
+ "ids": [
+ "64899",
+ "8163",
+ "156554",
+ "360361",
+ "204554",
+ "391463",
+ "368056",
+ "590775",
+ "398365",
+ "418999",
+ "336468",
+ "454537",
+ "147684",
+ "519473",
+ "232983",
+ "582429",
+ "29886",
+ "566417",
+ "37134",
+ "171905",
+ "182989",
+ "352136",
+ "209107",
+ "551242",
+ "469423",
+ "374443",
+ "194899",
+ "164572",
+ "442710",
+ "98358"
+ ]
+ },
+ {
+ "q": "New vending route business, not sure how to determine taxes",
+ "wall_ms": 5735.724925994873,
+ "ids": [
+ "221968",
+ "451457",
+ "61983",
+ "125111",
+ "31697",
+ "372107",
+ "124480",
+ "387010",
+ "357293",
+ "548836",
+ "38704",
+ "408112",
+ "30970",
+ "497530",
+ "459275",
+ "493872",
+ "101265",
+ "208989",
+ "83080",
+ "297966",
+ "277373",
+ "129994",
+ "262761",
+ "359969",
+ "549601",
+ "72888",
+ "542213",
+ "32610",
+ "346712",
+ "501952"
+ ]
+ },
+ {
+ "q": "Finding a good small business CPA?",
+ "wall_ms": 6102.185964584351,
+ "ids": [
+ "90290",
+ "68717",
+ "398365",
+ "61947",
+ "429555",
+ "11401",
+ "218990",
+ "64899",
+ "338545",
+ "29886",
+ "366349",
+ "146657",
+ "470549",
+ "158738",
+ "117427",
+ "268314",
+ "20533",
+ "155781",
+ "158058",
+ "584232",
+ "154508",
+ "427469",
+ "527120",
+ "222726",
+ "277810",
+ "560776",
+ "104448",
+ "179420",
+ "195571",
+ "546841"
+ ]
+ },
+ {
+ "q": "Taxable income on full-time job + business earnings",
+ "wall_ms": 6408.249139785767,
+ "ids": [
+ "541809",
+ "199785",
+ "254151",
+ "90881",
+ "438801",
+ "444273",
+ "390368",
+ "496036",
+ "209107",
+ "595133",
+ "22710",
+ "265159",
+ "244518",
+ "513981",
+ "274722",
+ "81886",
+ "478987",
+ "562802",
+ "425308",
+ "192843",
+ "223170",
+ "93205",
+ "255101",
+ "557523",
+ "590775",
+ "193490",
+ "314342",
+ "109250",
+ "374676",
+ "150410"
+ ]
+ },
+ {
+ "q": "How can I lookup the business associated with a FEIN?",
+ "wall_ms": 6496.4752197265625,
+ "ids": [
+ "44635",
+ "391403",
+ "487179",
+ "317374",
+ "480443",
+ "55541",
+ "571800",
+ "190708",
+ "281732",
+ "78297",
+ "160859",
+ "595564",
+ "467603",
+ "566464",
+ "338545",
+ "560398",
+ "9114",
+ "532743",
+ "83059",
+ "278824",
+ "428671",
+ "471872",
+ "146657",
+ "282196",
+ "332675",
+ "66119",
+ "511455",
+ "559686",
+ "302594",
+ "144070"
+ ]
+ },
+ {
+ "q": "Tax Allocation - Business Asset Transfer",
+ "wall_ms": 7368.008852005005,
+ "ids": [
+ "459970",
+ "432935",
+ "150015",
+ "579319",
+ "143020",
+ "550345",
+ "218406",
+ "335857",
+ "458851",
+ "286689",
+ "593698",
+ "46345",
+ "218064",
+ "271949",
+ "337876",
+ "64868",
+ "373966",
+ "322049",
+ "549435",
+ "377166",
+ "291830",
+ "187571",
+ "307409",
+ "381104",
+ "131127",
+ "458244",
+ "583549",
+ "175252",
+ "186575",
+ "438294"
+ ]
+ },
+ {
+ "q": "How to Deduct Family Health Care Premiums Under Side Business",
+ "wall_ms": 6701.972961425781,
+ "ids": [
+ "410226",
+ "462831",
+ "525334",
+ "52065",
+ "54333",
+ "361954",
+ "128533",
+ "174605",
+ "41793",
+ "442347",
+ "509218",
+ "56",
+ "277498",
+ "214358",
+ "481322",
+ "187085",
+ "176599",
+ "359048",
+ "34035",
+ "526158",
+ "106810",
+ "157990",
+ "297938",
+ "493898",
+ "265213",
+ "174784",
+ "184210",
+ "540314",
+ "552240",
+ "414267"
+ ]
+ },
+ {
+ "q": "Claiming car as a business expense in the UK",
+ "wall_ms": 5690.08207321167,
+ "ids": [
+ "397608",
+ "390435",
+ "454526",
+ "471081",
+ "147245",
+ "197175",
+ "356884",
+ "418771",
+ "577284",
+ "63042",
+ "231279",
+ "276884",
+ "540395",
+ "215761",
+ "338700",
+ "476173",
+ "539752",
+ "11132",
+ "289620",
+ "327002",
+ "571062",
+ "385929",
+ "447231",
+ "427884",
+ "541809",
+ "444899",
+ "265904",
+ "40257",
+ "377019",
+ "492456"
+ ]
+ },
+ {
+ "q": "Do I need to keep paper records for my business?",
+ "wall_ms": 6121.891975402832,
+ "ids": [
+ "263521",
+ "374443",
+ "64556",
+ "97719",
+ "537593",
+ "552581",
+ "576985",
+ "540571",
+ "195207",
+ "358631",
+ "132780",
+ "147245",
+ "144054",
+ "522358",
+ "305065",
+ "435919",
+ "190856",
+ "210345",
+ "64899",
+ "584032",
+ "123366",
+ "406215",
+ "468016",
+ "8854",
+ "574142",
+ "527776",
+ "172997",
+ "319058",
+ "278656",
+ "402275"
+ ]
+ },
+ {
+ "q": "1040 Schedule A Un-Reimbursed Business Expense Reporting",
+ "wall_ms": 5451.458215713501,
+ "ids": [
+ "574417",
+ "254151",
+ "254158",
+ "351672",
+ "524134",
+ "90290",
+ "41793",
+ "429555",
+ "289620",
+ "341258",
+ "174025",
+ "562777",
+ "132780",
+ "451020",
+ "223624",
+ "409566",
+ "523564",
+ "174714",
+ "192516",
+ "360756",
+ "511592",
+ "400631",
+ "128861",
+ "482165",
+ "214358",
+ "401832",
+ "512151",
+ "334603",
+ "411063",
+ "477476"
+ ]
+ },
+ {
+ "q": "Why do banks require small businesses to open a business bank account instead of a cheaper personal one?",
+ "wall_ms": 5735.491991043091,
+ "ids": [
+ "310103",
+ "261856",
+ "464449",
+ "364378",
+ "309909",
+ "188167",
+ "98636",
+ "130631",
+ "400230",
+ "109203",
+ "5219",
+ "284351",
+ "391463",
+ "156756",
+ "229546",
+ "251063",
+ "340857",
+ "195207",
+ "377152",
+ "413229",
+ "294359",
+ "137572",
+ "580624",
+ "274832",
+ "381151",
+ "547301",
+ "396191",
+ "8186",
+ "579066",
+ "344928"
+ ]
+ },
+ {
+ "q": "How to treat miles driven to the mechanic, gas station, etc when calculating business use of car?",
+ "wall_ms": 7830.941200256348,
+ "ids": [
+ "397608",
+ "307131",
+ "40257",
+ "405412",
+ "92144",
+ "467363",
+ "350796",
+ "540395",
+ "88967",
+ "380851",
+ "83504",
+ "519929",
+ "91545",
+ "99771",
+ "205697",
+ "154931",
+ "295246",
+ "117819",
+ "277498",
+ "324411",
+ "402249",
+ "487016",
+ "106371",
+ "167951",
+ "447231",
+ "322238",
+ "48522",
+ "385237",
+ "260638",
+ "172736"
+ ]
+ },
+ {
+ "q": "value of guaranteeing a business loan",
+ "wall_ms": 6753.562211990356,
+ "ids": [
+ "365963",
+ "18792",
+ "335543",
+ "294864",
+ "130631",
+ "131131",
+ "119117",
+ "368010",
+ "318472",
+ "471123",
+ "198562",
+ "273759",
+ "143728",
+ "385074",
+ "216321",
+ "436347",
+ "74975",
+ "283733",
+ "108770",
+ "502775",
+ "82025",
+ "125371",
+ "310326",
+ "309077",
+ "456463",
+ "7540",
+ "176687",
+ "102088",
+ "187526",
+ "46394"
+ ]
+ },
+ {
+ "q": "Deducting business expenses paid for by gift card",
+ "wall_ms": 9354.547023773193,
+ "ids": [
+ "195207",
+ "354716",
+ "130631",
+ "537593",
+ "132745",
+ "234743",
+ "189034",
+ "562777",
+ "338700",
+ "339425",
+ "83346",
+ "274721",
+ "391619",
+ "541809",
+ "202457",
+ "574060",
+ "201546",
+ "462831",
+ "204554",
+ "329957",
+ "381151",
+ "481114",
+ "245447",
+ "364938",
+ "406418",
+ "450878",
+ "189642",
+ "523564",
+ "203271",
+ "18850"
+ ]
+ },
+ {
+ "q": "Car as business expense, but not because of driving",
+ "wall_ms": 6108.741044998169,
+ "ids": [
+ "397608",
+ "381151",
+ "427884",
+ "40257",
+ "545087",
+ "226243",
+ "541809",
+ "130631",
+ "547704",
+ "166495",
+ "475663",
+ "205098",
+ "586488",
+ "324911",
+ "390435",
+ "336615",
+ "410421",
+ "69058",
+ "464177",
+ "540395",
+ "385929",
+ "499335",
+ "327002",
+ "221933",
+ "354974",
+ "399370",
+ "519173",
+ "505467",
+ "447231",
+ "416799"
+ ]
+ },
+ {
+ "q": "Can a business refuse to take credit cards?",
+ "wall_ms": 5349.464893341064,
+ "ids": [
+ "352379",
+ "261583",
+ "6341",
+ "170481",
+ "493638",
+ "173929",
+ "274721",
+ "428258",
+ "536497",
+ "35530",
+ "183839",
+ "421743",
+ "537593",
+ "171398",
+ "346444",
+ "394928",
+ "372052",
+ "336468",
+ "233751",
+ "193081",
+ "249505",
+ "176284",
+ "417301",
+ "289231",
+ "454412",
+ "74044",
+ "249971",
+ "302412",
+ "397175",
+ "235808"
+ ]
+ },
+ {
+ "q": "Calculate Estimated Tax on Hobby Business LLC",
+ "wall_ms": 5136.569023132324,
+ "ids": [
+ "68969",
+ "334603",
+ "440506",
+ "132780",
+ "444273",
+ "546372",
+ "207449",
+ "286689",
+ "556021",
+ "387906",
+ "418630",
+ "175951",
+ "283505",
+ "509111",
+ "525149",
+ "272248",
+ "328517",
+ "313361",
+ "388713",
+ "390368",
+ "85622",
+ "271772",
+ "536849",
+ "196374",
+ "227079",
+ "35810",
+ "18570",
+ "452896",
+ "68486",
+ "446117"
+ ]
+ },
+ {
+ "q": "Buying car from rental business without title",
+ "wall_ms": 4782.457113265991,
+ "ids": [
+ "66338",
+ "340802",
+ "575172",
+ "427884",
+ "400945",
+ "563025",
+ "389164",
+ "424125",
+ "298159",
+ "525386",
+ "143499",
+ "153812",
+ "75132",
+ "537593",
+ "51771",
+ "397608",
+ "110046",
+ "131177",
+ "103589",
+ "211451",
+ "113516",
+ "175522",
+ "249017",
+ "346628",
+ "380763",
+ "320529",
+ "118280",
+ "398141",
+ "117274",
+ "131334"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/fix.json b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/fix.json
new file mode 100644
index 000000000..5e1ae3354
--- /dev/null
+++ b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/fix.json
@@ -0,0 +1,2606 @@
+{
+ "semantic": [
+ {
+ "q": "What is considered a business expense on a business trip?",
+ "wall_ms": 8511.197805404663,
+ "ids": [
+ "429555",
+ "351672",
+ "338700",
+ "289620",
+ "308472",
+ "231449",
+ "192516",
+ "538208",
+ "327002",
+ "348480"
+ ]
+ },
+ {
+ "q": "Business Expense - Car Insurance Deductible For Accident That Occurred During a Business Trip",
+ "wall_ms": 271.9287872314453,
+ "ids": [
+ "562777",
+ "360361",
+ "397608",
+ "327002",
+ "351672",
+ "434619",
+ "97719",
+ "274721",
+ "289620",
+ "153377"
+ ]
+ },
+ {
+ "q": "Starting a new online business",
+ "wall_ms": 246.2460994720459,
+ "ids": [
+ "429555",
+ "428471",
+ "444444",
+ "399762",
+ "143499",
+ "584232",
+ "90290",
+ "483942",
+ "282958",
+ "64899"
+ ]
+ },
+ {
+ "q": "\u201cBusiness day\u201d and \u201cdue date\u201d for bills",
+ "wall_ms": 305.4327964782715,
+ "ids": [
+ "47957",
+ "41214",
+ "99986",
+ "434266",
+ "162389",
+ "14461",
+ "438103",
+ "19694",
+ "396662",
+ "524878"
+ ]
+ },
+ {
+ "q": "New business owner - How do taxes work for the business vs individual?",
+ "wall_ms": 260.90312004089355,
+ "ids": [
+ "338700",
+ "476562",
+ "563025",
+ "8163",
+ "426343",
+ "143728",
+ "390368",
+ "160859",
+ "538208",
+ "429555"
+ ]
+ },
+ {
+ "q": "Hobby vs. Business",
+ "wall_ms": 232.34987258911133,
+ "ids": [
+ "153377",
+ "540634",
+ "143499",
+ "444444",
+ "563025",
+ "338700",
+ "428471",
+ "419717",
+ "360361",
+ "429555"
+ ]
+ },
+ {
+ "q": "Personal checks instead of business ones",
+ "wall_ms": 238.739013671875,
+ "ids": [
+ "400230",
+ "130631",
+ "135196",
+ "98636",
+ "390368",
+ "552216",
+ "591416",
+ "414836",
+ "97719",
+ "446870"
+ ]
+ },
+ {
+ "q": "Does U.S. tax code call for small business owners to count business purchases as personal income?",
+ "wall_ms": 259.4597339630127,
+ "ids": [
+ "541809",
+ "390368",
+ "264068",
+ "265398",
+ "234743",
+ "203820",
+ "101265",
+ "141458",
+ "64899",
+ "588327"
+ ]
+ },
+ {
+ "q": "How can I register a UK business without providing a business address?",
+ "wall_ms": 272.65214920043945,
+ "ids": [
+ "429555",
+ "348480",
+ "64899",
+ "584232",
+ "428471",
+ "537593",
+ "130631",
+ "465041",
+ "32985",
+ "196374"
+ ]
+ },
+ {
+ "q": "What are 'business fundamentals'?",
+ "wall_ms": 238.14702033996582,
+ "ids": [
+ "563025",
+ "477208",
+ "368056",
+ "433806",
+ "442347",
+ "444444",
+ "136262",
+ "547553",
+ "192516",
+ "181412"
+ ]
+ },
+ {
+ "q": "Business Investment Loss from prior year",
+ "wall_ms": 244.0650463104248,
+ "ids": [
+ "333954",
+ "51615",
+ "174025",
+ "563025",
+ "38335",
+ "389164",
+ "115274",
+ "143499",
+ "368056",
+ "153377"
+ ]
+ },
+ {
+ "q": "How can I estimate business taxes / filing fees for a business that has $0 income?",
+ "wall_ms": 282.7880382537842,
+ "ids": [
+ "429555",
+ "180690",
+ "64899",
+ "160859",
+ "338700",
+ "195207",
+ "107794",
+ "541809",
+ "480287",
+ "582429"
+ ]
+ },
+ {
+ "q": "Would the purchase of a car for a business through the use of a business loan be considered a business expense?",
+ "wall_ms": 289.71266746520996,
+ "ids": [
+ "289620",
+ "130631",
+ "444444",
+ "454526",
+ "540395",
+ "471123",
+ "538208",
+ "143728",
+ "418771",
+ "429555"
+ ]
+ },
+ {
+ "q": "Deducting last years (undocumented) side business loss",
+ "wall_ms": 239.31527137756348,
+ "ids": [
+ "581265",
+ "115274",
+ "184495",
+ "406419",
+ "368056",
+ "533808",
+ "360361",
+ "153377",
+ "574417",
+ "155781"
+ ]
+ },
+ {
+ "q": "30% share in business",
+ "wall_ms": 233.34884643554688,
+ "ids": [
+ "563025",
+ "336468",
+ "428471",
+ "143499",
+ "484414",
+ "444444",
+ "545964",
+ "360361",
+ "338700",
+ "584232"
+ ]
+ },
+ {
+ "q": "Claiming business expense from personal credit card",
+ "wall_ms": 248.9938735961914,
+ "ids": [
+ "336468",
+ "425487",
+ "354716",
+ "6341",
+ "447738",
+ "381151",
+ "388076",
+ "397608",
+ "423569",
+ "519644"
+ ]
+ },
+ {
+ "q": "Using business check to pay at retail",
+ "wall_ms": 273.7550735473633,
+ "ids": [
+ "397186",
+ "32066",
+ "435825",
+ "267121",
+ "456373",
+ "203820",
+ "172518",
+ "444444",
+ "279480",
+ "408308"
+ ]
+ },
+ {
+ "q": "Tax whilst starting a business in full time employment",
+ "wall_ms": 287.25671768188477,
+ "ids": [
+ "6568",
+ "282958",
+ "43370",
+ "10717",
+ "444444",
+ "429555",
+ "141458",
+ "193367",
+ "82627",
+ "413209"
+ ]
+ },
+ {
+ "q": "Can I pay off my credit card balance to free up available credit?",
+ "wall_ms": 256.8051815032959,
+ "ids": [
+ "65537",
+ "423505",
+ "499180",
+ "292038",
+ "81206",
+ "425352",
+ "273528",
+ "403934",
+ "188406",
+ "467581"
+ ]
+ },
+ {
+ "q": "Starting a side business slowly",
+ "wall_ms": 272.5210189819336,
+ "ids": [
+ "429555",
+ "590775",
+ "444444",
+ "175072",
+ "348480",
+ "419717",
+ "29886",
+ "192516",
+ "155781",
+ "132780"
+ ]
+ },
+ {
+ "q": "Why is \u201ccheque cashing\u201d a legitimate business?",
+ "wall_ms": 223.33121299743652,
+ "ids": [
+ "155781",
+ "429555",
+ "338700",
+ "360361",
+ "351672",
+ "471316",
+ "563025",
+ "518205",
+ "584232",
+ "538208"
+ ]
+ },
+ {
+ "q": "Is business the only way to become a millionaire?",
+ "wall_ms": 244.56000328063965,
+ "ids": [
+ "229110",
+ "425387",
+ "539752",
+ "143728",
+ "23408",
+ "504243",
+ "508754",
+ "100764",
+ "538208",
+ "451421"
+ ]
+ },
+ {
+ "q": "Valuing a small business to invest in",
+ "wall_ms": 271.99578285217285,
+ "ids": [
+ "444444",
+ "117427",
+ "24917",
+ "366141",
+ "259948",
+ "35810",
+ "464264",
+ "360361",
+ "141458",
+ "563025"
+ ]
+ },
+ {
+ "q": "Starting a large business with a not so large income?",
+ "wall_ms": 257.92598724365234,
+ "ids": [
+ "429555",
+ "192516",
+ "235711",
+ "196374",
+ "237316",
+ "371515",
+ "337352",
+ "441260",
+ "422331",
+ "313361"
+ ]
+ },
+ {
+ "q": "Requirements for filing business taxes?",
+ "wall_ms": 297.36995697021484,
+ "ids": [
+ "387573",
+ "274832",
+ "181412",
+ "248624",
+ "179420",
+ "444589",
+ "334107",
+ "336468",
+ "101265",
+ "54225"
+ ]
+ },
+ {
+ "q": "IRA for work and my business",
+ "wall_ms": 276.5498161315918,
+ "ids": [
+ "47957",
+ "86852",
+ "115274",
+ "44578",
+ "512803",
+ "354716",
+ "406130",
+ "37134",
+ "450840",
+ "368056"
+ ]
+ },
+ {
+ "q": "Advice on money transfer business",
+ "wall_ms": 258.1760883331299,
+ "ids": [
+ "475798",
+ "563025",
+ "433806",
+ "590775",
+ "488037",
+ "288074",
+ "24612",
+ "221239",
+ "237338",
+ "220682"
+ ]
+ },
+ {
+ "q": "How to transfer personal auto lease to business auto lease?",
+ "wall_ms": 292.8299903869629,
+ "ids": [
+ "13215",
+ "384994",
+ "241054",
+ "367434",
+ "324779",
+ "476219",
+ "513051",
+ "64279",
+ "516777",
+ "30970"
+ ]
+ },
+ {
+ "q": "Tutoring Business Payroll Management",
+ "wall_ms": 246.74510955810547,
+ "ids": [
+ "88346",
+ "143499",
+ "447167",
+ "115274",
+ "584232",
+ "428471",
+ "386178",
+ "444444",
+ "429555",
+ "324911"
+ ]
+ },
+ {
+ "q": "As a small business owner, should I pay my taxes from my personal or business checking account?",
+ "wall_ms": 283.09106826782227,
+ "ids": [
+ "64556",
+ "338700",
+ "562777",
+ "537593",
+ "429555",
+ "64899",
+ "77201",
+ "471160",
+ "542213",
+ "258423"
+ ]
+ },
+ {
+ "q": "Should my husband's business pay my business?",
+ "wall_ms": 268.6200141906738,
+ "ids": [
+ "64556",
+ "537593",
+ "563025",
+ "338700",
+ "319785",
+ "428471",
+ "172518",
+ "117332",
+ "584232",
+ "440061"
+ ]
+ },
+ {
+ "q": "Why can't online transactions be completed outside of business hours?",
+ "wall_ms": 274.1968631744385,
+ "ids": [
+ "330865",
+ "120321",
+ "440061",
+ "186718",
+ "29404",
+ "576728",
+ "130631",
+ "55200",
+ "428471",
+ "410327"
+ ]
+ },
+ {
+ "q": "Full-time work + running small side business: Best business structure for taxes?",
+ "wall_ms": 275.0668525695801,
+ "ids": [
+ "64899",
+ "8163",
+ "368056",
+ "360361",
+ "156554",
+ "336468",
+ "519473",
+ "582429",
+ "29886",
+ "204554"
+ ]
+ },
+ {
+ "q": "New vending route business, not sure how to determine taxes",
+ "wall_ms": 207.73911476135254,
+ "ids": [
+ "451457",
+ "61983",
+ "31697",
+ "124480",
+ "548836",
+ "38704",
+ "30970",
+ "459275",
+ "101265",
+ "83080"
+ ]
+ },
+ {
+ "q": "Finding a good small business CPA?",
+ "wall_ms": 289.1838550567627,
+ "ids": [
+ "90290",
+ "429555",
+ "11401",
+ "64899",
+ "29886",
+ "470549",
+ "68717",
+ "117427",
+ "155781",
+ "584232"
+ ]
+ },
+ {
+ "q": "Taxable income on full-time job + business earnings",
+ "wall_ms": 233.7968349456787,
+ "ids": [
+ "90881",
+ "444273",
+ "390368",
+ "541809",
+ "595133",
+ "265159",
+ "244518",
+ "199785",
+ "81886",
+ "254151"
+ ]
+ },
+ {
+ "q": "How can I lookup the business associated with a FEIN?",
+ "wall_ms": 265.13195037841797,
+ "ids": [
+ "487179",
+ "480443",
+ "55541",
+ "281732",
+ "160859",
+ "44635",
+ "566464",
+ "560398",
+ "532743",
+ "83059"
+ ]
+ },
+ {
+ "q": "Tax Allocation - Business Asset Transfer",
+ "wall_ms": 271.66008949279785,
+ "ids": [
+ "432935",
+ "150015",
+ "550345",
+ "218406",
+ "459970",
+ "286689",
+ "218064",
+ "337876",
+ "373966",
+ "322049"
+ ]
+ },
+ {
+ "q": "How to Deduct Family Health Care Premiums Under Side Business",
+ "wall_ms": 244.34995651245117,
+ "ids": [
+ "462831",
+ "361954",
+ "174605",
+ "442347",
+ "52065",
+ "277498",
+ "481322",
+ "410226",
+ "176599",
+ "525334"
+ ]
+ },
+ {
+ "q": "Claiming car as a business expense in the UK",
+ "wall_ms": 270.29895782470703,
+ "ids": [
+ "454526",
+ "471081",
+ "147245",
+ "397608",
+ "418771",
+ "63042",
+ "276884",
+ "338700",
+ "539752",
+ "289620"
+ ]
+ },
+ {
+ "q": "Do I need to keep paper records for my business?",
+ "wall_ms": 278.08403968811035,
+ "ids": [
+ "97719",
+ "537593",
+ "374443",
+ "263521",
+ "195207",
+ "147245",
+ "144054",
+ "435919",
+ "190856",
+ "64899"
+ ]
+ },
+ {
+ "q": "1040 Schedule A Un-Reimbursed Business Expense Reporting",
+ "wall_ms": 261.1231803894043,
+ "ids": [
+ "574417",
+ "351672",
+ "90290",
+ "429555",
+ "289620",
+ "562777",
+ "132780",
+ "409566",
+ "254151",
+ "192516"
+ ]
+ },
+ {
+ "q": "Why do banks require small businesses to open a business bank account instead of a cheaper personal one?",
+ "wall_ms": 259.91296768188477,
+ "ids": [
+ "130631",
+ "261856",
+ "188167",
+ "364378",
+ "284351",
+ "98636",
+ "310103",
+ "464449",
+ "229546",
+ "309909"
+ ]
+ },
+ {
+ "q": "How to treat miles driven to the mechanic, gas station, etc when calculating business use of car?",
+ "wall_ms": 232.48004913330078,
+ "ids": [
+ "307131",
+ "40257",
+ "467363",
+ "350796",
+ "380851",
+ "83504",
+ "99771",
+ "397608",
+ "295246",
+ "277498"
+ ]
+ },
+ {
+ "q": "value of guaranteeing a business loan",
+ "wall_ms": 260.19287109375,
+ "ids": [
+ "335543",
+ "365963",
+ "130631",
+ "119117",
+ "471123",
+ "198562",
+ "385074",
+ "436347",
+ "283733",
+ "108770"
+ ]
+ },
+ {
+ "q": "Deducting business expenses paid for by gift card",
+ "wall_ms": 238.61384391784668,
+ "ids": [
+ "195207",
+ "537593",
+ "234743",
+ "562777",
+ "338700",
+ "83346",
+ "541809",
+ "202457",
+ "462831",
+ "204554"
+ ]
+ },
+ {
+ "q": "Car as business expense, but not because of driving",
+ "wall_ms": 265.6419277191162,
+ "ids": [
+ "381151",
+ "397608",
+ "545087",
+ "226243",
+ "130631",
+ "475663",
+ "586488",
+ "324911",
+ "410421",
+ "69058"
+ ]
+ },
+ {
+ "q": "Can a business refuse to take credit cards?",
+ "wall_ms": 226.62591934204102,
+ "ids": [
+ "170481",
+ "352379",
+ "274721",
+ "428258",
+ "261583",
+ "421743",
+ "537593",
+ "171398",
+ "394928",
+ "6341"
+ ]
+ },
+ {
+ "q": "Calculate Estimated Tax on Hobby Business LLC",
+ "wall_ms": 258.9423656463623,
+ "ids": [
+ "444273",
+ "68969",
+ "440506",
+ "286689",
+ "387906",
+ "175951",
+ "509111",
+ "328517",
+ "334603",
+ "390368"
+ ]
+ },
+ {
+ "q": "Buying car from rental business without title",
+ "wall_ms": 282.20605850219727,
+ "ids": [
+ "66338",
+ "575172",
+ "563025",
+ "389164",
+ "298159",
+ "143499",
+ "340802",
+ "537593",
+ "397608",
+ "131177"
+ ]
+ }
+ ],
+ "hybrid": [
+ {
+ "q": "What is considered a business expense on a business trip?",
+ "wall_ms": 377.31194496154785,
+ "ids": [
+ "338700",
+ "327002",
+ "308472",
+ "429555",
+ "531578",
+ "351672",
+ "417981",
+ "216077",
+ "289620",
+ "571062",
+ "231449",
+ "531442",
+ "55200",
+ "192516",
+ "538208",
+ "104464",
+ "348480",
+ "528838",
+ "540325",
+ "562777",
+ "153377",
+ "297841",
+ "396056",
+ "73427",
+ "541809",
+ "324911",
+ "74688",
+ "560087",
+ "381151",
+ "278460"
+ ]
+ },
+ {
+ "q": "Business Expense - Car Insurance Deductible For Accident That Occurred During a Business Trip",
+ "wall_ms": 303.06506156921387,
+ "ids": [
+ "397608",
+ "562777",
+ "327002",
+ "153377",
+ "434619",
+ "97719",
+ "531578",
+ "360361",
+ "332161",
+ "390435",
+ "351672",
+ "462831",
+ "274721",
+ "540395",
+ "289620",
+ "417981",
+ "455984",
+ "447231",
+ "149210",
+ "18850",
+ "194308",
+ "40257",
+ "550345",
+ "381151",
+ "216077",
+ "272137",
+ "405356",
+ "528564",
+ "209224",
+ "354716"
+ ]
+ },
+ {
+ "q": "Starting a new online business",
+ "wall_ms": 267.0779228210449,
+ "ids": [
+ "428471",
+ "444444",
+ "115274",
+ "429555",
+ "504056",
+ "528206",
+ "398365",
+ "399762",
+ "143499",
+ "553540",
+ "480717",
+ "584232",
+ "90290",
+ "401004",
+ "56747",
+ "483942",
+ "104485",
+ "282958",
+ "64899",
+ "130598",
+ "484979",
+ "50444",
+ "331616",
+ "555430",
+ "282947",
+ "582134",
+ "237338",
+ "32345",
+ "372229",
+ "525334"
+ ]
+ },
+ {
+ "q": "\u201cBusiness day\u201d and \u201cdue date\u201d for bills",
+ "wall_ms": 333.5731029510498,
+ "ids": [
+ "14461",
+ "41214",
+ "47957",
+ "78139",
+ "560251",
+ "99986",
+ "188530",
+ "210300",
+ "434266",
+ "162389",
+ "396679",
+ "372036",
+ "36193",
+ "438103",
+ "19694",
+ "522358",
+ "382442",
+ "396662",
+ "20116",
+ "524878",
+ "152279",
+ "257841",
+ "226984",
+ "286843",
+ "25906",
+ "258439",
+ "595121",
+ "44593",
+ "564488",
+ "477720"
+ ]
+ },
+ {
+ "q": "New business owner - How do taxes work for the business vs individual?",
+ "wall_ms": 289.4167900085449,
+ "ids": [
+ "338700",
+ "8163",
+ "429555",
+ "227757",
+ "145016",
+ "476562",
+ "563025",
+ "19640",
+ "426343",
+ "588253",
+ "64899",
+ "143728",
+ "141458",
+ "390368",
+ "160859",
+ "542213",
+ "538208",
+ "219274",
+ "480717",
+ "125111",
+ "407524",
+ "128435",
+ "483664",
+ "62335",
+ "287214",
+ "262761",
+ "483385",
+ "130631",
+ "393553",
+ "538199"
+ ]
+ },
+ {
+ "q": "Hobby vs. Business",
+ "wall_ms": 247.41601943969727,
+ "ids": [
+ "153377",
+ "540634",
+ "330",
+ "283505",
+ "143499",
+ "167494",
+ "444444",
+ "563025",
+ "338700",
+ "562176",
+ "428471",
+ "525149",
+ "313361",
+ "419717",
+ "132780",
+ "360361",
+ "429555",
+ "451020",
+ "51211",
+ "25439",
+ "466442",
+ "381151",
+ "28764",
+ "278824",
+ "250498",
+ "427017",
+ "309023",
+ "32973",
+ "95441",
+ "273472"
+ ]
+ },
+ {
+ "q": "Personal checks instead of business ones",
+ "wall_ms": 264.24193382263184,
+ "ids": [
+ "400230",
+ "98636",
+ "135196",
+ "591416",
+ "552216",
+ "130631",
+ "390368",
+ "598834",
+ "8854",
+ "282103",
+ "414836",
+ "6503",
+ "97719",
+ "413229",
+ "446870",
+ "354314",
+ "438975",
+ "3763",
+ "333292",
+ "53649",
+ "399762",
+ "45519",
+ "292989",
+ "431637",
+ "64556",
+ "84645",
+ "542213",
+ "338700",
+ "576185",
+ "14466"
+ ]
+ },
+ {
+ "q": "Does U.S. tax code call for small business owners to count business purchases as personal income?",
+ "wall_ms": 292.30713844299316,
+ "ids": [
+ "588327",
+ "390368",
+ "541809",
+ "141458",
+ "264068",
+ "338700",
+ "85622",
+ "192516",
+ "265398",
+ "234743",
+ "326717",
+ "203820",
+ "519473",
+ "101265",
+ "152027",
+ "116009",
+ "64899",
+ "411063",
+ "182168",
+ "46791",
+ "192332",
+ "363495",
+ "173212",
+ "257168",
+ "412855",
+ "336468",
+ "245447",
+ "40257",
+ "334902",
+ "350819"
+ ]
+ },
+ {
+ "q": "How can I register a UK business without providing a business address?",
+ "wall_ms": 271.8019485473633,
+ "ids": [
+ "348480",
+ "429555",
+ "507811",
+ "86852",
+ "48840",
+ "64899",
+ "315516",
+ "584232",
+ "428471",
+ "442425",
+ "245011",
+ "537593",
+ "130631",
+ "439109",
+ "310103",
+ "465041",
+ "32985",
+ "268257",
+ "196374",
+ "266229",
+ "272574",
+ "295624",
+ "562176",
+ "248629",
+ "200023",
+ "380972",
+ "106007",
+ "122986",
+ "370334",
+ "164427"
+ ]
+ },
+ {
+ "q": "What are 'business fundamentals'?",
+ "wall_ms": 252.3350715637207,
+ "ids": [
+ "398960",
+ "563025",
+ "350497",
+ "477208",
+ "368056",
+ "509659",
+ "433806",
+ "546115",
+ "442347",
+ "558539",
+ "385949",
+ "444444",
+ "136262",
+ "507829",
+ "151442",
+ "547553",
+ "11148",
+ "192516",
+ "181412",
+ "490899",
+ "5054",
+ "436557",
+ "198609",
+ "380672",
+ "70185",
+ "248217",
+ "524513",
+ "296401",
+ "361929",
+ "50119"
+ ]
+ },
+ {
+ "q": "Business Investment Loss from prior year",
+ "wall_ms": 264.68396186828613,
+ "ids": [
+ "51615",
+ "333954",
+ "128045",
+ "202114",
+ "174025",
+ "330269",
+ "194319",
+ "563025",
+ "38335",
+ "490176",
+ "381120",
+ "389164",
+ "115274",
+ "266898",
+ "143499",
+ "362060",
+ "298387",
+ "368056",
+ "153377",
+ "193485",
+ "487256",
+ "107794",
+ "261224",
+ "454082",
+ "426343",
+ "375929",
+ "14255",
+ "169240",
+ "520080",
+ "128861"
+ ]
+ },
+ {
+ "q": "How can I estimate business taxes / filing fees for a business that has $0 income?",
+ "wall_ms": 321.98095321655273,
+ "ids": [
+ "308113",
+ "429555",
+ "180690",
+ "248629",
+ "64899",
+ "208989",
+ "153541",
+ "160859",
+ "338700",
+ "533808",
+ "195207",
+ "254158",
+ "66492",
+ "107794",
+ "69306",
+ "541809",
+ "303078",
+ "480287",
+ "133235",
+ "582429",
+ "502875",
+ "523564",
+ "490489",
+ "444589",
+ "313012",
+ "117877",
+ "561750",
+ "344340",
+ "258611",
+ "132780"
+ ]
+ },
+ {
+ "q": "Would the purchase of a car for a business through the use of a business loan be considered a business expense?",
+ "wall_ms": 344.39706802368164,
+ "ids": [
+ "540395",
+ "130631",
+ "73427",
+ "289620",
+ "97719",
+ "397608",
+ "444444",
+ "454526",
+ "327002",
+ "338700",
+ "471123",
+ "447231",
+ "538208",
+ "143728",
+ "390435",
+ "418771",
+ "541809",
+ "363495",
+ "429555",
+ "85622",
+ "40257",
+ "245447",
+ "427884",
+ "268747",
+ "216077",
+ "404726",
+ "571062",
+ "474795",
+ "531442",
+ "540325"
+ ]
+ },
+ {
+ "q": "Deducting last years (undocumented) side business loss",
+ "wall_ms": 240.89288711547852,
+ "ids": [
+ "406419",
+ "292919",
+ "581265",
+ "330",
+ "115274",
+ "184495",
+ "362060",
+ "421301",
+ "368056",
+ "368229",
+ "57149",
+ "533808",
+ "64899",
+ "360361",
+ "19183",
+ "153377",
+ "574417",
+ "582189",
+ "155781",
+ "231183",
+ "532888",
+ "336451",
+ "262039",
+ "381151",
+ "86134",
+ "474795",
+ "293310",
+ "137517",
+ "160105",
+ "425523"
+ ]
+ },
+ {
+ "q": "30% share in business",
+ "wall_ms": 253.5538673400879,
+ "ids": [
+ "341424",
+ "563025",
+ "188220",
+ "336468",
+ "218468",
+ "428471",
+ "143499",
+ "297032",
+ "394597",
+ "484414",
+ "444444",
+ "465313",
+ "204209",
+ "545964",
+ "360361",
+ "565909",
+ "73457",
+ "338700",
+ "144033",
+ "584232",
+ "129481",
+ "420379",
+ "44666",
+ "238682",
+ "582736",
+ "535605",
+ "522040",
+ "599876",
+ "246295",
+ "445353"
+ ]
+ },
+ {
+ "q": "Claiming business expense from personal credit card",
+ "wall_ms": 270.62487602233887,
+ "ids": [
+ "354716",
+ "336468",
+ "447738",
+ "6341",
+ "381151",
+ "397608",
+ "425487",
+ "74688",
+ "274721",
+ "176284",
+ "222771",
+ "245447",
+ "388076",
+ "114494",
+ "423569",
+ "233751",
+ "519644",
+ "195207",
+ "283079",
+ "85517",
+ "268747",
+ "95860",
+ "562777",
+ "71987",
+ "399199",
+ "390435",
+ "290687",
+ "172518",
+ "470066",
+ "368679"
+ ]
+ },
+ {
+ "q": "Using business check to pay at retail",
+ "wall_ms": 282.6828956604004,
+ "ids": [
+ "2456",
+ "397186",
+ "1873",
+ "32066",
+ "274721",
+ "435825",
+ "48866",
+ "267121",
+ "165691",
+ "456373",
+ "203820",
+ "588219",
+ "172518",
+ "552216",
+ "85522",
+ "444444",
+ "279480",
+ "545722",
+ "224000",
+ "408308",
+ "17469",
+ "441568",
+ "173444",
+ "206375",
+ "586026",
+ "446870",
+ "452594",
+ "117378",
+ "361042",
+ "383188"
+ ]
+ },
+ {
+ "q": "Tax whilst starting a business in full time employment",
+ "wall_ms": 312.3300075531006,
+ "ids": [
+ "6568",
+ "223170",
+ "282958",
+ "541809",
+ "43370",
+ "223624",
+ "10717",
+ "13712",
+ "444444",
+ "528206",
+ "428533",
+ "429555",
+ "141458",
+ "398365",
+ "193367",
+ "592192",
+ "82627",
+ "367577",
+ "149291",
+ "413209",
+ "152298",
+ "119277",
+ "483489",
+ "350669",
+ "593371",
+ "450808",
+ "279636",
+ "193922",
+ "163693",
+ "446117"
+ ]
+ },
+ {
+ "q": "Can I pay off my credit card balance to free up available credit?",
+ "wall_ms": 291.7149066925049,
+ "ids": [
+ "423505",
+ "65537",
+ "403934",
+ "273528",
+ "417301",
+ "269947",
+ "499180",
+ "292038",
+ "487621",
+ "81206",
+ "330049",
+ "425352",
+ "509075",
+ "113167",
+ "188406",
+ "121233",
+ "467581",
+ "13656",
+ "21576",
+ "11719",
+ "589543",
+ "513256",
+ "143844",
+ "551175",
+ "321199",
+ "565856",
+ "524149",
+ "321136",
+ "287157",
+ "277590"
+ ]
+ },
+ {
+ "q": "Starting a side business slowly",
+ "wall_ms": 298.57802391052246,
+ "ids": [
+ "590775",
+ "444444",
+ "398365",
+ "429555",
+ "181624",
+ "553009",
+ "175072",
+ "391590",
+ "202208",
+ "348480",
+ "349692",
+ "419717",
+ "29886",
+ "68302",
+ "192516",
+ "155781",
+ "239459",
+ "132780",
+ "198591",
+ "480121",
+ "55499",
+ "384409",
+ "283615",
+ "19113",
+ "109383",
+ "483305",
+ "516056",
+ "528206",
+ "184495",
+ "407672"
+ ]
+ },
+ {
+ "q": "Why is \u201ccheque cashing\u201d a legitimate business?",
+ "wall_ms": 245.74017524719238,
+ "ids": [
+ "338700",
+ "360361",
+ "155781",
+ "220644",
+ "213081",
+ "429555",
+ "212713",
+ "16774",
+ "153505",
+ "351672",
+ "471316",
+ "525803",
+ "86852",
+ "563025",
+ "518205",
+ "590102",
+ "301833",
+ "584232",
+ "449082",
+ "538208",
+ "400947",
+ "261856",
+ "84645",
+ "65404",
+ "45185",
+ "475054",
+ "244445",
+ "456636",
+ "69623",
+ "377853"
+ ]
+ },
+ {
+ "q": "Is business the only way to become a millionaire?",
+ "wall_ms": 281.1930179595947,
+ "ids": [
+ "425387",
+ "229110",
+ "402230",
+ "434972",
+ "539752",
+ "36482",
+ "143728",
+ "23408",
+ "254638",
+ "11675",
+ "504243",
+ "323873",
+ "508754",
+ "100764",
+ "597880",
+ "41960",
+ "538208",
+ "434869",
+ "451421",
+ "1099",
+ "448816",
+ "556359",
+ "227072",
+ "443097",
+ "351926",
+ "139058",
+ "148681",
+ "95200",
+ "519798",
+ "70075"
+ ]
+ },
+ {
+ "q": "Valuing a small business to invest in",
+ "wall_ms": 300.5218505859375,
+ "ids": [
+ "117427",
+ "444444",
+ "50735",
+ "161162",
+ "24917",
+ "72276",
+ "366141",
+ "546108",
+ "259948",
+ "568196",
+ "35810",
+ "72510",
+ "259227",
+ "464264",
+ "360361",
+ "441384",
+ "141458",
+ "163621",
+ "563025",
+ "593556",
+ "535300",
+ "62244",
+ "430890",
+ "567479",
+ "72131",
+ "320471",
+ "471247",
+ "179042",
+ "454526",
+ "91076"
+ ]
+ },
+ {
+ "q": "Starting a large business with a not so large income?",
+ "wall_ms": 293.2276725769043,
+ "ids": [
+ "429555",
+ "87480",
+ "192516",
+ "560393",
+ "235711",
+ "545419",
+ "196374",
+ "460353",
+ "237316",
+ "287214",
+ "153375",
+ "371515",
+ "206140",
+ "337352",
+ "441260",
+ "487929",
+ "422331",
+ "499163",
+ "313361",
+ "423416",
+ "325906",
+ "335136",
+ "436729",
+ "322906",
+ "232377",
+ "338700",
+ "85028",
+ "423083",
+ "514697",
+ "512304"
+ ]
+ },
+ {
+ "q": "Requirements for filing business taxes?",
+ "wall_ms": 310.94813346862793,
+ "ids": [
+ "248624",
+ "387573",
+ "446190",
+ "84528",
+ "274832",
+ "181412",
+ "308113",
+ "294123",
+ "158136",
+ "179420",
+ "248629",
+ "444589",
+ "334107",
+ "425804",
+ "153541",
+ "336468",
+ "101265",
+ "366761",
+ "54225",
+ "447940",
+ "43350",
+ "107584",
+ "475410",
+ "370542",
+ "595121",
+ "221281",
+ "223170",
+ "360925",
+ "333681",
+ "249322"
+ ]
+ },
+ {
+ "q": "IRA for work and my business",
+ "wall_ms": 303.76696586608887,
+ "ids": [
+ "47957",
+ "151544",
+ "86852",
+ "294644",
+ "115274",
+ "248536",
+ "44578",
+ "277810",
+ "236348",
+ "512803",
+ "192857",
+ "354716",
+ "104934",
+ "406130",
+ "37134",
+ "196961",
+ "372014",
+ "450840",
+ "368056",
+ "463182",
+ "110114",
+ "332113",
+ "447482",
+ "569953",
+ "410453",
+ "542414",
+ "163865",
+ "64899",
+ "216243",
+ "345282"
+ ]
+ },
+ {
+ "q": "Advice on money transfer business",
+ "wall_ms": 283.77318382263184,
+ "ids": [
+ "288074",
+ "24612",
+ "475798",
+ "483305",
+ "563025",
+ "589718",
+ "433806",
+ "469776",
+ "30935",
+ "590775",
+ "212312",
+ "488037",
+ "352927",
+ "150903",
+ "199808",
+ "221239",
+ "237338",
+ "562007",
+ "220682",
+ "564129",
+ "535918",
+ "150450",
+ "514968",
+ "71987",
+ "589692",
+ "426518",
+ "333616",
+ "122986",
+ "447828",
+ "343872"
+ ]
+ },
+ {
+ "q": "How to transfer personal auto lease to business auto lease?",
+ "wall_ms": 330.0909996032715,
+ "ids": [
+ "13215",
+ "179891",
+ "67663",
+ "384994",
+ "34626",
+ "241054",
+ "284610",
+ "367434",
+ "324779",
+ "440806",
+ "311748",
+ "476219",
+ "265904",
+ "513051",
+ "64279",
+ "292982",
+ "182192",
+ "516777",
+ "30970",
+ "343961",
+ "145276",
+ "205742",
+ "314050",
+ "438463",
+ "390435",
+ "256981",
+ "116643",
+ "118280",
+ "398141",
+ "489277"
+ ]
+ },
+ {
+ "q": "Tutoring Business Payroll Management",
+ "wall_ms": 261.57093048095703,
+ "ids": [
+ "386178",
+ "88346",
+ "190485",
+ "143499",
+ "369993",
+ "164040",
+ "447167",
+ "115274",
+ "372666",
+ "123693",
+ "584232",
+ "184698",
+ "428471",
+ "589398",
+ "444444",
+ "484968",
+ "18647",
+ "429555",
+ "324911",
+ "476980",
+ "388856",
+ "385320",
+ "436701",
+ "388078",
+ "582104",
+ "311704",
+ "240323",
+ "302722",
+ "510148",
+ "532839"
+ ]
+ },
+ {
+ "q": "As a small business owner, should I pay my taxes from my personal or business checking account?",
+ "wall_ms": 318.13621520996094,
+ "ids": [
+ "537593",
+ "542213",
+ "338700",
+ "64899",
+ "64556",
+ "562777",
+ "77201",
+ "547301",
+ "374443",
+ "357938",
+ "429555",
+ "177946",
+ "413229",
+ "146317",
+ "471160",
+ "227757",
+ "19640",
+ "258423",
+ "83346",
+ "297965",
+ "98636",
+ "393553",
+ "334393",
+ "309909",
+ "591416",
+ "8163",
+ "400230",
+ "135196",
+ "396792",
+ "86852"
+ ]
+ },
+ {
+ "q": "Should my husband's business pay my business?",
+ "wall_ms": 284.1920852661133,
+ "ids": [
+ "319785",
+ "537593",
+ "64556",
+ "571143",
+ "193367",
+ "322838",
+ "563025",
+ "338700",
+ "592192",
+ "374443",
+ "428471",
+ "172518",
+ "568512",
+ "117332",
+ "352640",
+ "109250",
+ "584232",
+ "440061",
+ "477208",
+ "22193",
+ "444589",
+ "272279",
+ "572774",
+ "83059",
+ "290113",
+ "97719",
+ "367754",
+ "107584",
+ "134902",
+ "155193"
+ ]
+ },
+ {
+ "q": "Why can't online transactions be completed outside of business hours?",
+ "wall_ms": 297.63197898864746,
+ "ids": [
+ "120321",
+ "309171",
+ "330865",
+ "65227",
+ "440061",
+ "2565",
+ "186718",
+ "29404",
+ "157518",
+ "576728",
+ "580935",
+ "130631",
+ "277964",
+ "55200",
+ "461009",
+ "241444",
+ "428471",
+ "304662",
+ "410327",
+ "448110",
+ "376170",
+ "397510",
+ "338096",
+ "176061",
+ "73797",
+ "417133",
+ "163522",
+ "374451",
+ "182255",
+ "86929"
+ ]
+ },
+ {
+ "q": "Full-time work + running small side business: Best business structure for taxes?",
+ "wall_ms": 299.86000061035156,
+ "ids": [
+ "64899",
+ "8163",
+ "156554",
+ "360361",
+ "204554",
+ "391463",
+ "368056",
+ "590775",
+ "398365",
+ "418999",
+ "336468",
+ "454537",
+ "147684",
+ "519473",
+ "232983",
+ "582429",
+ "29886",
+ "566417",
+ "37134",
+ "171905",
+ "182989",
+ "352136",
+ "209107",
+ "551242",
+ "469423",
+ "374443",
+ "194899",
+ "164572",
+ "442710",
+ "98358"
+ ]
+ },
+ {
+ "q": "New vending route business, not sure how to determine taxes",
+ "wall_ms": 224.99513626098633,
+ "ids": [
+ "221968",
+ "451457",
+ "61983",
+ "125111",
+ "31697",
+ "372107",
+ "124480",
+ "387010",
+ "357293",
+ "548836",
+ "38704",
+ "408112",
+ "30970",
+ "497530",
+ "459275",
+ "493872",
+ "101265",
+ "208989",
+ "83080",
+ "297966",
+ "277373",
+ "129994",
+ "262761",
+ "359969",
+ "549601",
+ "72888",
+ "542213",
+ "32610",
+ "346712",
+ "501952"
+ ]
+ },
+ {
+ "q": "Finding a good small business CPA?",
+ "wall_ms": 312.79802322387695,
+ "ids": [
+ "90290",
+ "68717",
+ "398365",
+ "61947",
+ "429555",
+ "11401",
+ "218990",
+ "64899",
+ "338545",
+ "29886",
+ "366349",
+ "146657",
+ "470549",
+ "158738",
+ "117427",
+ "268314",
+ "20533",
+ "155781",
+ "158058",
+ "584232",
+ "154508",
+ "427469",
+ "527120",
+ "222726",
+ "277810",
+ "560776",
+ "104448",
+ "179420",
+ "195571",
+ "546841"
+ ]
+ },
+ {
+ "q": "Taxable income on full-time job + business earnings",
+ "wall_ms": 259.1869831085205,
+ "ids": [
+ "541809",
+ "199785",
+ "254151",
+ "90881",
+ "438801",
+ "444273",
+ "390368",
+ "496036",
+ "209107",
+ "595133",
+ "22710",
+ "265159",
+ "244518",
+ "513981",
+ "274722",
+ "81886",
+ "478987",
+ "562802",
+ "425308",
+ "192843",
+ "223170",
+ "93205",
+ "255101",
+ "557523",
+ "590775",
+ "193490",
+ "314342",
+ "109250",
+ "374676",
+ "150410"
+ ]
+ },
+ {
+ "q": "How can I lookup the business associated with a FEIN?",
+ "wall_ms": 291.18800163269043,
+ "ids": [
+ "44635",
+ "391403",
+ "487179",
+ "317374",
+ "480443",
+ "55541",
+ "571800",
+ "190708",
+ "281732",
+ "78297",
+ "160859",
+ "595564",
+ "467603",
+ "566464",
+ "338545",
+ "560398",
+ "9114",
+ "532743",
+ "83059",
+ "278824",
+ "428671",
+ "471872",
+ "146657",
+ "282196",
+ "332675",
+ "66119",
+ "511455",
+ "559686",
+ "302594",
+ "144070"
+ ]
+ },
+ {
+ "q": "Tax Allocation - Business Asset Transfer",
+ "wall_ms": 289.078950881958,
+ "ids": [
+ "459970",
+ "432935",
+ "150015",
+ "579319",
+ "143020",
+ "550345",
+ "218406",
+ "335857",
+ "458851",
+ "286689",
+ "593698",
+ "46345",
+ "218064",
+ "271949",
+ "337876",
+ "64868",
+ "373966",
+ "322049",
+ "549435",
+ "377166",
+ "291830",
+ "187571",
+ "307409",
+ "381104",
+ "131127",
+ "458244",
+ "583549",
+ "175252",
+ "186575",
+ "438294"
+ ]
+ },
+ {
+ "q": "How to Deduct Family Health Care Premiums Under Side Business",
+ "wall_ms": 271.6500759124756,
+ "ids": [
+ "410226",
+ "462831",
+ "525334",
+ "52065",
+ "54333",
+ "361954",
+ "128533",
+ "174605",
+ "41793",
+ "442347",
+ "509218",
+ "56",
+ "277498",
+ "214358",
+ "481322",
+ "187085",
+ "176599",
+ "359048",
+ "34035",
+ "526158",
+ "106810",
+ "157990",
+ "297938",
+ "493898",
+ "265213",
+ "174784",
+ "184210",
+ "540314",
+ "552240",
+ "414267"
+ ]
+ },
+ {
+ "q": "Claiming car as a business expense in the UK",
+ "wall_ms": 301.1889457702637,
+ "ids": [
+ "397608",
+ "390435",
+ "454526",
+ "471081",
+ "147245",
+ "197175",
+ "356884",
+ "418771",
+ "577284",
+ "63042",
+ "231279",
+ "276884",
+ "540395",
+ "215761",
+ "338700",
+ "476173",
+ "539752",
+ "11132",
+ "289620",
+ "327002",
+ "571062",
+ "385929",
+ "447231",
+ "427884",
+ "541809",
+ "444899",
+ "265904",
+ "40257",
+ "377019",
+ "492456"
+ ]
+ },
+ {
+ "q": "Do I need to keep paper records for my business?",
+ "wall_ms": 317.3081874847412,
+ "ids": [
+ "263521",
+ "374443",
+ "64556",
+ "97719",
+ "537593",
+ "552581",
+ "576985",
+ "540571",
+ "195207",
+ "358631",
+ "132780",
+ "147245",
+ "144054",
+ "522358",
+ "305065",
+ "435919",
+ "190856",
+ "210345",
+ "64899",
+ "584032",
+ "123366",
+ "406215",
+ "468016",
+ "8854",
+ "574142",
+ "527776",
+ "172997",
+ "319058",
+ "278656",
+ "402275"
+ ]
+ },
+ {
+ "q": "1040 Schedule A Un-Reimbursed Business Expense Reporting",
+ "wall_ms": 299.8321056365967,
+ "ids": [
+ "574417",
+ "254151",
+ "254158",
+ "351672",
+ "524134",
+ "90290",
+ "41793",
+ "429555",
+ "289620",
+ "341258",
+ "174025",
+ "562777",
+ "132780",
+ "451020",
+ "223624",
+ "409566",
+ "523564",
+ "174714",
+ "192516",
+ "360756",
+ "511592",
+ "400631",
+ "128861",
+ "482165",
+ "214358",
+ "401832",
+ "512151",
+ "334603",
+ "411063",
+ "477476"
+ ]
+ },
+ {
+ "q": "Why do banks require small businesses to open a business bank account instead of a cheaper personal one?",
+ "wall_ms": 298.74110221862793,
+ "ids": [
+ "310103",
+ "261856",
+ "464449",
+ "364378",
+ "309909",
+ "188167",
+ "98636",
+ "130631",
+ "400230",
+ "109203",
+ "5219",
+ "284351",
+ "391463",
+ "156756",
+ "229546",
+ "251063",
+ "340857",
+ "195207",
+ "377152",
+ "413229",
+ "294359",
+ "137572",
+ "580624",
+ "274832",
+ "381151",
+ "547301",
+ "396191",
+ "8186",
+ "579066",
+ "344928"
+ ]
+ },
+ {
+ "q": "How to treat miles driven to the mechanic, gas station, etc when calculating business use of car?",
+ "wall_ms": 266.9639587402344,
+ "ids": [
+ "397608",
+ "307131",
+ "40257",
+ "405412",
+ "92144",
+ "467363",
+ "350796",
+ "540395",
+ "88967",
+ "380851",
+ "83504",
+ "519929",
+ "91545",
+ "99771",
+ "205697",
+ "154931",
+ "295246",
+ "117819",
+ "277498",
+ "324411",
+ "402249",
+ "487016",
+ "106371",
+ "167951",
+ "447231",
+ "322238",
+ "48522",
+ "385237",
+ "260638",
+ "172736"
+ ]
+ },
+ {
+ "q": "value of guaranteeing a business loan",
+ "wall_ms": 287.5809669494629,
+ "ids": [
+ "365963",
+ "18792",
+ "335543",
+ "294864",
+ "130631",
+ "131131",
+ "119117",
+ "368010",
+ "318472",
+ "471123",
+ "198562",
+ "273759",
+ "143728",
+ "385074",
+ "216321",
+ "436347",
+ "74975",
+ "283733",
+ "108770",
+ "502775",
+ "82025",
+ "125371",
+ "310326",
+ "309077",
+ "456463",
+ "7540",
+ "176687",
+ "102088",
+ "187526",
+ "46394"
+ ]
+ },
+ {
+ "q": "Deducting business expenses paid for by gift card",
+ "wall_ms": 247.99013137817383,
+ "ids": [
+ "195207",
+ "354716",
+ "130631",
+ "537593",
+ "132745",
+ "234743",
+ "189034",
+ "562777",
+ "338700",
+ "339425",
+ "83346",
+ "274721",
+ "391619",
+ "541809",
+ "202457",
+ "574060",
+ "201546",
+ "462831",
+ "204554",
+ "329957",
+ "381151",
+ "481114",
+ "245447",
+ "364938",
+ "406418",
+ "450878",
+ "189642",
+ "523564",
+ "203271",
+ "18850"
+ ]
+ },
+ {
+ "q": "Car as business expense, but not because of driving",
+ "wall_ms": 295.6991195678711,
+ "ids": [
+ "397608",
+ "381151",
+ "427884",
+ "40257",
+ "545087",
+ "226243",
+ "541809",
+ "130631",
+ "547704",
+ "166495",
+ "475663",
+ "205098",
+ "586488",
+ "324911",
+ "390435",
+ "336615",
+ "410421",
+ "69058",
+ "464177",
+ "540395",
+ "385929",
+ "499335",
+ "327002",
+ "221933",
+ "354974",
+ "399370",
+ "519173",
+ "505467",
+ "447231",
+ "416799"
+ ]
+ },
+ {
+ "q": "Can a business refuse to take credit cards?",
+ "wall_ms": 254.20808792114258,
+ "ids": [
+ "352379",
+ "261583",
+ "6341",
+ "170481",
+ "493638",
+ "173929",
+ "274721",
+ "428258",
+ "536497",
+ "35530",
+ "183839",
+ "421743",
+ "537593",
+ "171398",
+ "346444",
+ "394928",
+ "372052",
+ "336468",
+ "233751",
+ "193081",
+ "249505",
+ "176284",
+ "417301",
+ "289231",
+ "454412",
+ "74044",
+ "249971",
+ "302412",
+ "397175",
+ "235808"
+ ]
+ },
+ {
+ "q": "Calculate Estimated Tax on Hobby Business LLC",
+ "wall_ms": 279.5290946960449,
+ "ids": [
+ "68969",
+ "334603",
+ "440506",
+ "132780",
+ "444273",
+ "546372",
+ "207449",
+ "286689",
+ "556021",
+ "387906",
+ "418630",
+ "175951",
+ "283505",
+ "509111",
+ "525149",
+ "272248",
+ "328517",
+ "313361",
+ "388713",
+ "390368",
+ "85622",
+ "271772",
+ "536849",
+ "196374",
+ "227079",
+ "35810",
+ "18570",
+ "452896",
+ "68486",
+ "446117"
+ ]
+ },
+ {
+ "q": "Buying car from rental business without title",
+ "wall_ms": 301.88488960266113,
+ "ids": [
+ "66338",
+ "340802",
+ "575172",
+ "427884",
+ "400945",
+ "563025",
+ "389164",
+ "424125",
+ "298159",
+ "525386",
+ "143499",
+ "153812",
+ "75132",
+ "537593",
+ "51771",
+ "397608",
+ "110046",
+ "131177",
+ "103589",
+ "211451",
+ "113516",
+ "175522",
+ "249017",
+ "346628",
+ "380763",
+ "320529",
+ "118280",
+ "398141",
+ "117274",
+ "131334"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/manifest.txt b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/manifest.txt
new file mode 100644
index 000000000..1e788989a
--- /dev/null
+++ b/benchmarks/beir-hybrid/results/2026-10-07-issue-1091/manifest.txt
@@ -0,0 +1,43 @@
+Run manifest — issue #1091 (hybrid/semantic first stage on FiQA), measured 2026-10-07
+====================================================================================
+
+Builds (matched: same profile, same merge base, built on the same machine)
+ baseline e4c6c027 (upstream main at the branch point), cargo build --release -p xerj-server
+ fix e4c6c027 + this PR's engine/storage change, cargo build --release -p xerj-server
+ both report "xerj v1.0.0-rc.87"
+
+Dataset
+ fiqa.zip sha256 32c7df99ed21252fdfb2cf3f5673502a8d245ee0c44c4a133570d92ce2b3ad02
+ (same archive as results/2026-09-30-judge-gate/manifest.txt), corpus.jsonl 57,638 docs
+ URL https://public.ukp.informatik.tu-darmstadt.de/thakur/BEIR/datasets/fiqa.zip
+
+Node
+ xerj --insecure --port <p> -d <fresh empty data dir> (default --embed-mode: lexical)
+ one node at a time, never both; nothing else measuring on the machine
+ Apple M5, 10 cores, 24 GB, macOS 27.0.1; auto memory limits (watermark 7,782 MB)
+
+Procedure, per build
+ 1. XERJ_URL=http://localhost:<p> python3 load.py corpus.jsonl fiqa
+ (load.py now retries a 429 from the memory breaker; a first attempt of this A/B
+ lost 21,218 documents of the fix arm to one, and its numbers were discarded)
+ 2. sleep 30
+ 3. python3 latency_1091.py run http://localhost:<p> fiqa queries.jsonl 50 <out>.json 57638
+ (refuses to measure unless _count == 57638)
+ then: python3 latency_1091.py diff baseline-e4c6c027.json fix.json
+
+Result (ab.log, verbatim)
+ baseline semantic first 7,164 ms p50 3,865 ms p95 6,398 ms max 6,987 ms
+ hybrid first 10,708 ms p50 5,772 ms p95 7,368 ms max 9,355 ms
+ memory-watermark crossings during the run: 25
+ fix semantic first 8,511 ms p50 261 ms p95 293 ms max 305 ms
+ hybrid first 377 ms p50 289 ms p95 330 ms max 344 ms
+ memory-watermark crossings during the run: 0
+ ranked ids identical, baseline vs fix: semantic 50/50, hybrid 50/50 (top 30 each)
+
+Reading it
+ p50/p95/max exclude each arm's first query. The fix's first semantic query is the
+ cold one: it builds every segment's vector column from the typed projection. The
+ hybrid arm runs second and finds the columns warm.
+ Absolute values are this machine's; the 13-26 s in the issue came from a different
+ box (8 pinned cores, neural embedder, co-tenant load). Not re-measured here:
+ --embed-mode neural, and nDCG (ids are identical, so ranking quality cannot move).
diff --git a/engine/crates/xerj-engine/src/index.rs b/engine/crates/xerj-engine/src/index.rs
index d912c0f57..78eccce45 100644
--- a/engine/crates/xerj-engine/src/index.rs
+++ b/engine/crates/xerj-engine/src/index.rs
@@ -15115,6 +15115,206 @@ impl Index {
))
}
+ /// Whether the exact scan makes a candidate of the stored copy `id` with
+ /// `doc_seq`, recording it in `seen` when it does. Shared by the scan over
+ /// stored documents and the scan over a cached column (#1091), so the two
+ /// cannot disagree about which copy is live.
+ fn admit_exact_scan_candidate(
+ &self,
+ seen: &mut HashSet<String>,
+ id: &str,
+ doc_seq: Option<u64>,
+ ) -> bool {
+ if let Some(ver) = self.store.version_map.get(id) {
+ // Skip tombstoned (deleted) docs.
+ if ver.deleted {
+ return false;
+ }
+ // Superseded stale copy (same predicate as the b8 T2
+ // fix in the count path): an updated doc appears in
+ // both its old and new segments, and first-seen dedup
+ // over oldest-first segment order would resurrect the
+ // PRE-update vector (live-verified 2026-07-12: update
+ // + flush + kNN returned the old vector as if the
+ // update never happened). Skip BEFORE `seen` so the
+ // stale copy can't shadow the live one. Legacy docs
+ // without `_seq_no` keep the first-seen dedup.
+ if let Some(doc_seq) = doc_seq {
+ if doc_seq < ver.seq_no {
+ return false;
+ }
+ }
+ }
+ if seen.contains(id) {
+ return false;
+ }
+ seen.insert(id.to_string());
+ true
+ }
+
+ /// Run `work` on the engine's background pool and await its answer —
+ /// never on tokio's blocking pool, for the #751 reason spelled out in
+ /// `stored_values_for_async`. A panic answers `None`, as there.
+ async fn on_background_pool<T, F>(work: F) -> Option<T>
+ where
+ T: Send + 'static,
+ F: FnOnce() -> Option<T> + Send + 'static,
+ {
+ let (sender, receiver) = tokio::sync::oneshot::channel();
+ crate::background_pool().spawn(move || {
+ let answer =
+ std::panic::catch_unwind(std::panic::AssertUnwindSafe(work)).unwrap_or(None);
+ let _ = sender.send(answer);
+ });
+ receiver.await.ok().flatten()
+ }
+
+ /// #1091: build a segment's `BestPassage` vector column from the storage
+ /// layer's typed kNN projection — identity and vector columns decoded
+ /// straight to `f32`, no `_source` reconstructed — and publish it under
+ /// `column_key`. The decode it replaces materialised every stored document
+ /// as `serde_json::Value` (~53 KB a document on FiQA's passage-chunked
+ /// corpus), and that transient alone pushed RSS over the memory watermark,
+ /// whose drain then dropped every cached column again.
+ ///
+ /// `Unavailable` whenever the projection cannot stand in for the stored
+ /// documents — a legacy or ZBS3 section, no such vector column, a cell
+ /// shape the typed decoder refuses — and the caller reads the stored
+ /// documents instead.
+ async fn projected_vector_column(
+ &self,
+ segment_id: &str,
+ field: &str,
+ column_key: String,
+ ) -> ProjectedColumn {
+ use crate::vector_column::{ColumnBuilder, ColumnMode};
+ use xerj_storage::stored_codec::{
+ decode_stored_v2_knn_projection, StoredV2KnnProjectionResult,
+ };
+
+ let Ok(permit) = Arc::clone(&self.stored_value_load_semaphore)
+ .acquire_owned()
+ .await
+ else {
+ return ProjectedColumn::Unavailable;
+ };
+ let store = Arc::clone(&self.store);
+ let load_segment_id = segment_id.to_string();
+ let vector_field = field.to_string();
+ let built = Self::on_background_pool(move || {
+ let _permit = permit;
+ let reader = store.open_segment_arc(&load_segment_id).ok()?;
+ // A segment of tombstones alone has no stored section: nothing to
+ // scan, exactly as the stored-document path skips it.
+ let Some(bytes) = reader.section(SectionType::Stored).ok()? else {
+ return Some(None);
+ };
+ let chunk_field = format!("{vector_field}_chunks");
+ let StoredV2KnnProjectionResult::Projected(projection) =
+ decode_stored_v2_knn_projection(bytes, &vector_field, Some(&chunk_field)).ok()?
+ else {
+ return None;
+ };
+ let rows = projection.num_docs;
+ if projection.ids.len() != rows
+ || projection.seq_nos.len() != rows
+ || projection.vectors.len() != rows
+ || projection
+ .vector_chunks
+ .as_ref()
+ .is_some_and(|chunks| chunks.len() != rows)
+ {
+ return None;
+ }
+ let mut builder = ColumnBuilder::new(&vector_field, ColumnMode::BestPassage);
+ for row in 0..rows {
+ builder.push_projected(
+ projection.ids[row].as_deref(),
+ projection.seq_nos[row],
+ projection.vectors[row].as_deref(),
+ projection
+ .vector_chunks
+ .as_ref()
+ .and_then(|chunks| chunks[row].as_deref()),
+ );
+ }
+ Some(Some(builder.finish()))
+ })
+ .await;
+ let column = match built {
+ Some(Some(column)) => column,
+ Some(None) => return ProjectedColumn::NoStoredSection,
+ None => return ProjectedColumn::Unavailable,
+ };
+ let bytes = column
+ .retained_bytes()
+ .saturating_add(column_key.len() as u64);
+ ProjectedColumn::Built(self.publish_current(
+ &self.vector_column_cache,
+ segment_id,
+ column_key,
+ SegmentCacheCategory::VectorColumn,
+ bytes,
+ column,
+ ))
+ }
+
+ /// #1091: the `(_id, _source)` of the stored documents at `positions` of
+ /// one segment, decoded row-selectively, aligned with `positions`. These
+ /// are the very copies the scan scored — segments are immutable — so the
+ /// hit is what the full decode would have produced, less the top-level
+ /// `omit` fields when given. `None` when the section cannot be hydrated by
+ /// row; the caller then reads the segment's stored documents.
+ async fn hydrate_segment_rows(
+ &self,
+ segment_id: &str,
+ positions: Vec<usize>,
+ omit: Option<Arc<HashSet<String>>>,
+ ) -> Option<Vec<(String, Value)>> {
+ use xerj_storage::stored_codec::{
+ decode_stored_v2_rows, decode_stored_v2_rows_projected, stored_v2_source_column_names,
+ StoredV2RowHydrationResult,
+ };
+
+ let store = Arc::clone(&self.store);
+ let load_segment_id = segment_id.to_string();
+ Self::on_background_pool(move || {
+ let reader = store.open_segment_arc(&load_segment_id).ok()?;
+ let bytes = reader.section(SectionType::Stored).ok()??;
+ let hydrated = match omit {
+ // The vector companions are by far the largest columns of a
+ // passage-chunked segment, and a row-selective decode still
+ // walks a whole column to reach its rows: decoding them for
+ // ten hits cost seconds on FiQA. Every other column is read.
+ Some(omit) => {
+ let names = stored_v2_source_column_names(bytes).ok()??;
+ let include: Vec<&str> = names
+ .iter()
+ .map(String::as_str)
+ .filter(|name| !omit.contains(*name))
+ .collect();
+ decode_stored_v2_rows_projected(bytes, &positions, &include).ok()?
+ }
+ None => decode_stored_v2_rows(bytes, &positions).ok()?,
+ };
+ let StoredV2RowHydrationResult::Hydrated { rows, .. } = hydrated else {
+ return None;
+ };
+ let mut by_ordinal: HashMap<usize, (String, Value)> = rows
+ .into_iter()
+ .filter_map(|row| {
+ let id = row.id.as_str()?.to_string();
+ Some((row.ordinal, (id, Value::Object(row.source))))
+ })
+ .collect();
+ positions
+ .iter()
+ .map(|position| by_ordinal.remove(position))
+ .collect()
+ })
+ .await
+ }
+
#[allow(clippy::too_many_arguments)]
async fn run_knn_brute_force_with_deadline(
&self,
@@ -15128,6 +15328,67 @@ impl Index {
boost: Option<f32>,
min_similarity: Option<f32>,
) -> Result<SearchResult> {
+ // #1091: an unfiltered scan first ranks from vector columns alone and
+ // hydrates only the winners. It hands the request back (`None`) when a
+ // winner's segment can no longer be read — a merge retired it between
+ // scoring and hydration — and the scan below then answers from the
+ // stored documents, exactly as it always did.
+ if filter.is_none() {
+ if let Some(result) = self
+ .run_knn_exact_scan(
+ request,
+ deadline,
+ field,
+ query_vec,
+ k,
+ None,
+ similarity,
+ boost,
+ min_similarity,
+ true,
+ )
+ .await?
+ {
+ return Ok(result);
+ }
+ }
+ let result = self
+ .run_knn_exact_scan(
+ request,
+ deadline,
+ field,
+ query_vec,
+ k,
+ filter,
+ similarity,
+ boost,
+ min_similarity,
+ false,
+ )
+ .await?;
+ Ok(result.expect("a scan over stored documents always answers"))
+ }
+
+ /// The exact kNN scan. With `columns_only` (honoured only unfiltered and
+ /// off `scalar8`), a segment whose vector column is cached, or can be
+ /// built from the typed projection, is scanned from that column without
+ /// its stored documents, and the ranked winners are hydrated by position;
+ /// `Ok(None)` means one of them could not be, and the caller must rescan
+ /// without `columns_only`. Without it the result is always `Some`.
+ #[allow(clippy::too_many_arguments)]
+ async fn run_knn_exact_scan(
+ &self,
+ request: &SearchRequest,
+ deadline: std::time::Instant,
+ field: &str,
+ query_vec: &[f32],
+ k: usize,
+ filter: Option<Box<QueryNode>>,
+ similarity: &str,
+ boost: Option<f32>,
+ min_similarity: Option<f32>,
+ columns_only: bool,
+ ) -> Result<Option<SearchResult>> {
use crate::vector_column::{ColumnBuilder, ColumnMode, DocVectorsView};
let started = std::time::Instant::now();
@@ -15183,9 +15444,12 @@ impl Index {
)
.await
{
- return Ok(result);
+ return Ok(Some(result));
}
}
+ // The column-only scan needs no source before ranking; a filter reads
+ // sources, and `scalar8` keeps the scan its filtered oracle pins.
+ let columns_only = columns_only && filter.is_none() && !use_sq8;
// `scalar8` reads only the pooled vector; the default scan prefers the
// per-passage companion. The two shapes are cached under different keys.
@@ -15232,6 +15496,77 @@ impl Index {
timed_out = true;
break;
}
+ // The segment's vectors as flat `f32`s. Cached per immutable
+ // segment; on a miss it is derived in the SAME pass that collects
+ // candidates, so a cold query walks the stored documents once and
+ // keeps the cooperative checkpoints it always had. Every position
+ // is pushed — live or not — because liveness is this query's
+ // business and the column outlives it.
+ let column_key = format!("{}\u{1}{field}\u{1}{}", meta.id, column_mode.key_tag());
+ let cached_column = self
+ .vector_column_cache
+ .get(&column_key)
+ .map(|entry| Arc::clone(entry.value()));
+ // #1091: a cached column carries every position's `_id` and
+ // `_seq_no`, which is all candidate selection reads. Scanning it
+ // alone skips the segment's parsed stored documents — on a
+ // passage-chunked corpus tens of kilobytes a document, so they
+ // overflow the hydration budget and every query used to decode
+ // the whole corpus again (FiQA, 57,638 documents: 6-7 s a query).
+ if columns_only {
+ let column = match cached_column.as_ref() {
+ Some(column) => Some(Arc::clone(column)),
+ // Bounded like the stored-document load below: past the
+ // deadline the request stops waiting and reports a
+ // timed-out partial answer (the abandoned column is not
+ // published; the next query builds it again).
+ None => match tokio::time::timeout_at(
+ tokio::time::Instant::from_std(deadline),
+ self.projected_vector_column(&meta.id, field, column_key.clone()),
+ )
+ .await
+ {
+ Ok(ProjectedColumn::Built(column)) => Some(column),
+ Ok(ProjectedColumn::NoStoredSection) => continue,
+ Ok(ProjectedColumn::Unavailable) => None,
+ Err(_) => {
+ timed_out = true;
+ break;
+ }
+ },
+ };
+ if let Some(column) = column {
+ let view = segment_views.len();
+ let mut segment_complete = true;
+ for position in 0..column.len() {
+ if position & 127 == 0
+ && self.exact_scan_checkpoint(position, deadline).await
+ {
+ timed_out = true;
+ segment_complete = false;
+ break;
+ }
+ let Some((id, doc_seq)) = column.identity(position) else {
+ continue;
+ };
+ if self.admit_exact_scan_candidate(&mut seen, id, doc_seq) {
+ candidates.push(KnnCandidateAt::Segment { view, position });
+ }
+ }
+ segment_views.push(KnnSegmentView {
+ segment_id: meta.id.clone(),
+ docs: None,
+ column,
+ });
+ if trace_phases {
+ tracing::info!(index=%self.name, segment=%meta.id, elapsed_ms=segment_started.elapsed().as_millis() as u64, candidates=candidates.len(), "semantic_phase=column_segment");
+ }
+ if !segment_complete {
+ break;
+ }
+ continue;
+ }
+ }
let docs_arc = match tokio::time::timeout_at(
tokio::time::Instant::from_std(deadline),
self.stored_values_for_async(&meta.id),
@@ -15249,17 +15584,6 @@ impl Index {
timed_out = true;
break;
}
- // The segment's vectors as flat `f32`s. Cached per immutable
- // segment; on a miss it is derived in the SAME pass that collects
- // candidates, so a cold query walks the stored documents once and
- // keeps the cooperative checkpoints it always had. Every position
- // is pushed — live or not — because liveness is this query's
- // business and the column outlives it.
- let column_key = format!("{}\u{1}{field}\u{1}{}", meta.id, column_mode.key_tag());
- let cached_column = self
- .vector_column_cache
- .get(&column_key)
- .map(|entry| Arc::clone(entry.value()));
let mut builder = cached_column
.is_none()
.then(|| ColumnBuilder::new(field, column_mode));
@@ -15283,31 +15607,10 @@ impl Index {
let Some(id) = doc.get("_id").and_then(Value::as_str) else {
continue;
};
- if let Some(ver) = self.store.version_map.get(id) {
- // Skip tombstoned (deleted) docs.
- if ver.deleted {
- continue;
- }
- // Superseded stale copy (same predicate as the b8 T2
- // fix in the count path): an updated doc appears in
- // both its old and new segments, and first-seen dedup
- // over oldest-first segment order would resurrect the
- // PRE-update vector (live-verified 2026-07-12: update
- // + flush + kNN returned the old vector as if the
- // update never happened). Skip BEFORE `seen` so the
- // stale copy can't shadow the live one. Legacy docs
- // without `_seq_no` keep the first-seen dedup.
- if let Some(doc_seq) = doc.get("_seq_no").and_then(Value::as_u64) {
- if doc_seq < ver.seq_no {
- continue;
- }
- }
- }
- if seen.contains(id) {
- continue;
+ let doc_seq = doc.get("_seq_no").and_then(Value::as_u64);
+ if self.admit_exact_scan_candidate(&mut seen, id, doc_seq) {
+ candidates.push(KnnCandidateAt::Segment { view, position });
}
- seen.insert(id.to_string());
- candidates.push(KnnCandidateAt::Segment { view, position });
}
let column = match (cached_column, builder) {
(Some(column), _) => column,
@@ -15336,7 +15639,8 @@ impl Index {
(None, None) => unreachable!("a builder exists whenever the column is not cached"),
};
segment_views.push(KnnSegmentView {
- docs: docs_arc,
+ segment_id: meta.id.clone(),
+ docs: Some(docs_arc),
column,
});
if trace_phases {
@@ -15581,20 +15885,102 @@ impl Index {
// shared stored values, so a query pays for `k` sources, not for the
// corpus.
rank_knn_pool(&mut scored, k, |entry| entry.1);
- let ranked: Vec<(String, f32, Value, Option<u32>)> = scored
- .into_iter()
- .map(|(candidate, score, ordinal)| {
- let (id, source) = candidates[candidate].hydrate(&mem_docs, &segment_views);
- (id, score, source, ordinal)
- })
- .collect();
-
- // (result shaping is shared with the HNSW path so hits format / total
- // semantics cannot drift between the exact and approximate executors)
+ // #1091: winners in a column-scanned segment are hydrated together,
+ // one row-selective decode per segment, before the page is assembled.
+ let mut by_view: HashMap<usize, Vec<usize>> = HashMap::new();
+ for (candidate, _, _) in &scored {
+ if let KnnCandidateAt::Segment { view, position } = candidates[*candidate] {
+ if segment_views[view].docs.is_none() {
+ by_view.entry(view).or_default().push(position);
+ }
+ }
+ }
let generated_companion_fields = {
let schema = self.schema.read().await;
generated_embedding_companion_fields(&schema.schema)
};
+ // The default `_source` drops the generated embedding companions from
+ // every hit without reporting it (`apply_source_filter_measured`), and
+ // none of the shapes below reads a hit's source before that: so for
+ // them the companions are not hydrated at all. Anything else — an
+ // explicit `_source`, aggregations over the neighbours, `fields`,
+ // scripts, sort, collapse, rescore — gets the whole document.
+ let omit_companions = (matches!(request.source, SourceFilter::Default)
+ && !generated_companion_fields.is_empty()
+ && request.aggs.is_none()
+ && request.fields.is_empty()
+ && request.script_fields.is_none()
+ && request.sort.is_empty()
+ && request.collapse.is_none()
+ && request.rescore.is_empty())
+ .then(|| Arc::new(generated_companion_fields.clone()));
+ let mut column_hits: HashMap<(usize, usize), (String, Value)> = HashMap::new();
+ for (view, positions) in by_view {
+ let hydrate_started = std::time::Instant::now();
+ let rows_wanted = positions.len();
+ let rows = match self
+ .hydrate_segment_rows(
+ &segment_views[view].segment_id,
+ positions.clone(),
+ omit_companions.clone(),
+ )
+ .await
+ {
+ Some(rows) => rows,
+ // A section the row decoder cannot address — LZ4 below
+ // `V2_MIN_DOCS` documents, a ZBS3 wrapper, a dependency shape
+ // it refuses — is hydrated the way it always was, from the
+ // segment's parsed stored documents. Only a segment that is
+ // gone altogether sends the request back to a full rescan.
+ None => {
+ let Some(docs) = self
+ .stored_values_for_async(&segment_views[view].segment_id)
+ .await
+ else {
+ return Ok(None);
+ };
+ let Some(rows) = positions
+ .iter()
+ .map(|&position| docs.get(position).map(knn_stored_hit))
+ .collect::<Option<Vec<_>>>()
+ else {
+ return Ok(None);
+ };
+ rows
+ }
+ };
+ for (position, (id, source)) in positions.into_iter().zip(rows) {
+ // The row must be the document the column scored.
+ if segment_views[view]
+ .column
+ .identity(position)
+ .map(|(id, _)| id)
+ != Some(id.as_str())
+ {
+ return Ok(None);
+ }
+ column_hits.insert((view, position), (id, source));
+ }
+ if trace_phases {
+ tracing::info!(index=%self.name, segment=%segment_views[view].segment_id, rows=rows_wanted, elapsed_ms=hydrate_started.elapsed().as_millis() as u64, "semantic_phase=hydrate_rows");
+ }
+ }
+ let mut ranked: Vec<(String, f32, Value, Option<u32>)> = Vec::with_capacity(scored.len());
+ for (candidate, score, ordinal) in scored {
+ let (id, source) = match candidates[candidate].hydrate(&mem_docs, &segment_views) {
+ KnnHydrated::Ready(id, source) => (id, source),
+ KnnHydrated::Columnar { view, position } => {
+ match column_hits.remove(&(view, position)) {
+ Some(hit) => hit,
+ None => return Ok(None),
+ }
+ }
+ };
+ ranked.push((id, score, source, ordinal));
+ }
+
+ // (result shaping is shared with the HNSW path so hits format / total
+ // semantics cannot drift between the exact and approximate executors)
let mut result = knn_result_from_ranked(
self,
request,
@@ -15610,7 +15996,7 @@ impl Index {
if trace_phases {
tracing::info!(index=%self.name, elapsed_ms=started.elapsed().as_millis() as u64, hits=result.hits.len(), "semantic_phase=complete");
}
- Ok(result)
+ Ok(Some(result))
}
/// PURE multi-KNN executor (the ES top-level `knn: [...]` array form,
@@ -38828,12 +39214,34 @@ enum KnnCandidateAt {
}
/// One segment as the exact scan sees it: the shared parsed documents and the
-/// flat vectors derived from them, aligned by position.
+/// flat vectors derived from them, aligned by position. `docs` is `None` when
+/// an unfiltered scan read the segment from its cached column alone (#1091).
struct KnnSegmentView {
- docs: Resident<Vec<Value>>,
+ segment_id: String,
+ docs: Option<Resident<Vec<Value>>>,
column: Resident<crate::vector_column::SegmentVectorColumn>,
}
+/// What [`Index::projected_vector_column`] made of a segment (#1091).
+enum ProjectedColumn {
+ Built(Resident<crate::vector_column::SegmentVectorColumn>),
+ /// Tombstones only: there is nothing to scan.
+ NoStoredSection,
+ /// The projection cannot stand in; read the stored documents.
+ Unavailable,
+}
+
+/// A ranked candidate's hit, or what is needed to fetch it (#1091).
+enum KnnHydrated {
+ Ready(String, Value),
+ /// Its segment was scanned from the column alone: the scan hydrates it
+ /// from the segment by position.
+ Columnar {
+ view: usize,
+ position: usize,
+ },
+}
+
impl KnnCandidateAt {
/// The candidate's id and source, BORROWED — what the filter reads.
fn id_and_source<'a>(
@@ -38847,7 +39255,10 @@ impl KnnCandidateAt {
(id.as_str(), source.as_ref())
}
Self::Segment { view, position } => {
- let doc = &segment_views[view].docs[position];
+ let doc = &segment_views[view]
+ .docs
+ .as_ref()
+ .expect("a filtered scan always loads the stored documents")[position];
// A segment candidate is only ever created for a document
// with a string `_id`.
let id = doc.get("_id").and_then(Value::as_str).unwrap_or_default();
@@ -38861,36 +39272,45 @@ impl KnnCandidateAt {
&self,
mem_docs: &[(String, Arc<Value>)],
segment_views: &[KnnSegmentView],
- ) -> (String, Value) {
+ ) -> KnnHydrated {
match *self {
Self::Memtable(slot) => {
let (id, source) = &mem_docs[slot];
- (id.clone(), (**source).clone())
+ KnnHydrated::Ready(id.clone(), (**source).clone())
}
Self::Segment { view, position } => {
- let doc = &segment_views[view].docs[position];
- let id = doc
- .get("_id")
- .and_then(Value::as_str)
- .unwrap_or_default()
- .to_string();
- // Reassembled segment docs have shape
- // { "_id":..., "_seq_no":..., "_source": {...} }
- // and a hit carries the `_source`; legacy pre-M7 segments
- // without `_source` fall through to the wrapper minus `_id`.
- let source = doc.get("_source").cloned().unwrap_or_else(|| {
- let mut d = doc.clone();
- if let Some(obj) = d.as_object_mut() {
- obj.remove("_id");
- }
- d
- });
- (id, source)
+ let segment = &segment_views[view];
+ let Some(docs) = segment.docs.as_ref() else {
+ return KnnHydrated::Columnar { view, position };
+ };
+ let (id, source) = knn_stored_hit(&docs[position]);
+ KnnHydrated::Ready(id, source)
}
}
}
}
+/// A segment's stored document as a kNN hit: its `_id` and an owned source.
+/// Reassembled segment docs have shape
+/// { "_id":..., "_seq_no":..., "_source": {...} }
+/// and a hit carries the `_source`; legacy pre-M7 segments without `_source`
+/// fall through to the wrapper minus `_id`.
+fn knn_stored_hit(doc: &Value) -> (String, Value) {
+ let id = doc
+ .get("_id")
+ .and_then(Value::as_str)
+ .unwrap_or_default()
+ .to_string();
+ let source = doc.get("_source").cloned().unwrap_or_else(|| {
+ let mut d = doc.clone();
+ if let Some(obj) = d.as_object_mut() {
+ obj.remove("_id");
+ }
+ d
+ });
+ (id, source)
+}
+
/// How the exact kNN scan shows one document to its `filter` (#939).
///
/// `doc_matches_query_typed` reads `_id` out of the document it is handed, so
@@ -56989,6 +57409,14 @@ mod exact_scan_hydration_tests {
Engine::new(config).expect("engine")
}
+ /// One ingest shard: a flush writes one segment, not one per shard.
+ fn single_shard_engine(dir: &TempDir) -> Engine {
+ let mut config = xerj_common::config::Config::default();
+ config.server.data_dir = dir.path().to_string_lossy().into_owned();
+ config.engine.ingest_shards = 1;
+ Engine::new(config).expect("engine")
+ }
+
/// `compute_vector_similarity` as it stood before #939, verbatim. The
/// oracle must not share code with what it checks.
fn legacy_similarity(sim: &str, a: &[f32], b: &[f32]) -> f32 {
@@ -57628,6 +58056,211 @@ mod exact_scan_hydration_tests {
assert_eq!(rows(&before), rows(&scan().await.unwrap()));
}
+ /// `seed` without the shapes the typed projection refuses (a passage that
+ /// is not an array, a passage of the wrong kind), on an engine with one
+ /// ingest shard so each flush is one segment large enough to be written
+ /// columnar (a shard under `V2_MIN_DOCS` documents is written as LZ4).
+ /// Two segments, the second superseding and deleting part of the first,
+ /// plus a live memtable; every third document chunked. Returns how many
+ /// segments hold a columnar stored section.
+ async fn seed_projectable(idx: &Arc<Index>) -> usize {
+ let mut rng = Lcg(0x1091);
+ let shared = rng.vector();
+ for id in 0..400 {
+ idx.index_document_prepared(Some(format!("d{id}")), document(id, &mut rng, &shared))
+ .await
+ .unwrap();
+ }
+ idx.flush().await.unwrap();
+ for id in (0..400).step_by(9) {
+ idx.index_document_prepared(
+ Some(format!("d{id}")),
+ document(id + 1000, &mut rng, &shared),
+ )
+ .await
+ .unwrap();
+ }
+ for id in (5..400).step_by(17) {
+ idx.delete_document(&format!("d{id}")).await.unwrap();
+ }
+ for id in 400..600 {
+ idx.index_document_prepared(Some(format!("d{id}")), document(id, &mut rng, &shared))
+ .await
+ .unwrap();
+ }
+ idx.flush().await.unwrap();
+ for id in (3..600).step_by(31) {
+ idx.index_document_prepared(
+ Some(format!("d{id}")),
+ document(id + 2000, &mut rng, &shared),
+ )
+ .await
+ .unwrap();
+ }
+ idx.store
+ .snapshot()
+ .segments
+ .iter()
+ .filter(|meta| {
+ let reader = idx.store.open_segment_arc(&meta.id).unwrap();
+ reader
+ .section(SectionType::Stored)
+ .unwrap()
+ .is_some_and(xerj_storage::stored_codec::is_columnar_stored_magic)
+ })
+ .count()
+ }
+
+ /// #1091: an unfiltered exact scan ranks from the segments' vector
+ /// columns and hydrates only its winners, so it never parses a segment's
+ /// stored documents — not to build a column (the typed projection does
+ /// that), not to pick candidates, and not after those parsed documents
+ /// have been evicted. On a passage-chunked corpus those documents were
+ /// ~53 KB each and overflowed the hydration budget: FiQA paid a full
+ /// re-parse on every query (6-7 s). The answer stays the oracle's, bit
+ /// for bit.
+ #[tokio::test]
+ async fn unfiltered_exact_scan_never_parses_stored_documents() {
+ let dir = TempDir::new().unwrap();
+ let engine = single_shard_engine(&dir);
+ engine
+ .create_index("scan-1091", vector_schema(None))
+ .unwrap();
+ let idx = engine.get_index("scan-1091").unwrap();
+ idx.schema.write().await.dynamic = xerj_common::schema::DynamicMapping::Runtime;
+ let columnar = seed_projectable(&idx).await;
+ assert!(
+ columnar >= 2,
+ "the fixture needs columnar segments: {columnar}"
+ );
+ let with_stored = idx
+ .store
+ .snapshot()
+ .segments
+ .iter()
+ .filter(|meta| {
+ let reader = idx.store.open_segment_arc(&meta.id).unwrap();
+ reader.section(SectionType::Stored).unwrap().is_some()
+ })
+ .count();
+ assert_eq!(
+ columnar, with_stored,
+ "a legacy segment would be read the old way"
+ );
+ idx.test_stored_value_load_count.store(0, Ordering::Relaxed);
+
+ let mut rng = Lcg(0x5EED);
+ for round in 0..6 {
+ if round == 3 {
+ // What the memory-pressure drain does to parsed documents.
+ idx.stored_value_cache.clear();
+ }
+ let query = rng.vector();
+ for k in [1usize, 10, 1000] {
+ let request = SearchRequest {
+ size: k,
+ ..SearchRequest::default()
+ };
+ let got = idx
+ .run_knn_brute_force(
+ &request,
+ "body_vector",
+ &query,
+ k,
+ None,
+ "cosine",
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ idx.test_stored_value_load_count.load(Ordering::Relaxed),
+ 0,
+ "round {round} k={k}: the scan parsed a segment's stored documents"
+ );
+ let expected =
+ legacy_scan(&idx, "body_vector", &query, k, None, "cosine", None, None).await;
+ assert_eq!(
+ got.hits
+ .iter()
+ .map(|h| (h.id.clone(), h.score.to_bits()))
+ .collect::<Vec<_>>(),
+ expected
+ .iter()
+ .map(|(id, bits, _, _)| (id.clone(), *bits))
+ .collect::<Vec<_>>(),
+ "round {round} k={k}: ids, order and score bits"
+ );
+ // The default `_source` is exactly the oracle's document less
+ // the generated companions it never shows — which a
+ // column-scanned winner is hydrated without.
+ let companions = generated_embedding_companion_fields(&idx.schema().await);
+ for (hit, (_, _, _, source)) in got.hits.iter().zip(&expected) {
+ let mut want = source.clone();
+ strip_internal_passage_metadata(&mut want);
+ if let Some(map) = want.as_object_mut() {
+ map.retain(|key, _| !companions.contains(key));
+ }
+ assert_eq!(
+ hit.source, want,
+ "round {round} k={k}: source of {}",
+ hit.id
+ );
+ }
+ }
+ }
+ let column_keys = idx.vector_column_cache.len();
+ assert!(column_keys >= 2, "columns were never published");
+ }
+
+ /// #1091: a request that can see the generated companions — here an
+ /// explicit `_source: true` — is hydrated with them, from the scored copy.
+ #[tokio::test]
+ async fn column_scanned_hits_keep_companions_when_the_source_is_asked_for() {
+ let dir = TempDir::new().unwrap();
+ let engine = single_shard_engine(&dir);
+ engine
+ .create_index("scan-1091-source", vector_schema(None))
+ .unwrap();
+ let idx = engine.get_index("scan-1091-source").unwrap();
+ idx.schema.write().await.dynamic = xerj_common::schema::DynamicMapping::Runtime;
+ assert!(seed_projectable(&idx).await >= 2);
+ let query = Lcg(11).vector();
+ let request = SearchRequest {
+ size: 20,
+ source: SourceFilter::Enabled(true),
+ ..SearchRequest::default()
+ };
+ let got = idx
+ .run_knn_brute_force(
+ &request,
+ "body_vector",
+ &query,
+ 20,
+ None,
+ "cosine",
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ let expected =
+ legacy_scan(&idx, "body_vector", &query, 20, None, "cosine", None, None).await;
+ assert_eq!(got.hits.len(), expected.len());
+ let mut chunked = 0usize;
+ for (hit, (id, _, _, source)) in got.hits.iter().zip(&expected) {
+ assert_eq!(&hit.id, id);
+ assert_eq!(hit.source.get("body_vector"), source.get("body_vector"));
+ assert_eq!(
+ hit.source.get("body_vector_chunks"),
+ source.get("body_vector_chunks")
+ );
+ chunked += usize::from(hit.source.get("body_vector_chunks").is_some());
+ }
+ assert!(chunked > 0, "no chunked document among the hits");
+ }
+
#[test]
fn query_scorer_is_bit_identical_to_compute_vector_similarity() {
let mut rng = Lcg(42);
diff --git a/engine/crates/xerj-engine/src/vector_column.rs b/engine/crates/xerj-engine/src/vector_column.rs
index b99d3cdd9..e7b3aea19 100644
--- a/engine/crates/xerj-engine/src/vector_column.rs
+++ b/engine/crates/xerj-engine/src/vector_column.rs
@@ -131,12 +131,25 @@ pub(crate) struct SegmentVectorColumn {
data: Vec<f32>,
entries: Vec<VectorEntry>,
docs: Vec<DocVectors>,
+ /// Each position's `_id` and `_seq_no`, when it was pushed as a stored
+ /// segment document (#1091). These are the only two fields the exact scan
+ /// reads from a document before ranking it, so a column that carries them
+ /// lets an unfiltered scan choose its candidates without the segment's
+ /// parsed stored documents — which, on a passage-chunked corpus, are tens
+ /// of kilobytes each and do not fit the hydration budget.
+ identities: Vec<Option<DocIdentity>>,
+}
+
+/// A stored document's `_id` and `_seq_no`, as the scan reads them.
+#[derive(Debug)]
+struct DocIdentity {
+ id: Box<str>,
+ seq_no: Option<u64>,
}
impl SegmentVectorColumn {
/// Number of document positions covered. A column abandoned part-way (the
/// request's deadline passed) covers a prefix of its segment.
- #[cfg(test)]
pub(crate) fn len(&self) -> usize {
self.docs.len()
}
@@ -163,11 +176,30 @@ impl SegmentVectorColumn {
}
}
+ /// The `_id` and `_seq_no` of the stored document at `position`. `None`
+ /// past the end, for a document pushed by source alone (the memtable
+ /// scratch), and for a stored document with no string `_id` — the scan
+ /// never makes a candidate of that one.
+ pub(crate) fn identity(&self, position: usize) -> Option<(&str, Option<u64>)> {
+ self.identities
+ .get(position)?
+ .as_ref()
+ .map(|identity| (&*identity.id, identity.seq_no))
+ }
+
/// Bytes this column keeps alive, for the segment hydration budget.
pub(crate) fn retained_bytes(&self) -> u64 {
+ let id_bytes: usize = self
+ .identities
+ .iter()
+ .flatten()
+ .map(|identity| identity.id.len())
+ .sum();
let bytes = self.data.capacity() * std::mem::size_of::<f32>()
+ self.entries.capacity() * std::mem::size_of::<VectorEntry>()
+ self.docs.capacity() * std::mem::size_of::<DocVectors>()
+ + self.identities.capacity() * std::mem::size_of::<Option<DocIdentity>>()
+ + id_bytes
+ std::mem::size_of::<Self>();
u64::try_from(bytes).unwrap_or(u64::MAX)
}
@@ -197,6 +229,7 @@ impl ColumnBuilder {
self.column.data.clear();
self.column.entries.clear();
self.column.docs.clear();
+ self.column.identities.clear();
}
/// The column built so far.
@@ -208,17 +241,31 @@ impl ColumnBuilder {
self.column.data.shrink_to_fit();
self.column.entries.shrink_to_fit();
self.column.docs.shrink_to_fit();
+ self.column.identities.shrink_to_fit();
self.column
}
/// Append a segment's stored document: `{"_id", "_seq_no", "_source"}`,
/// or a legacy pre-`_source` document whose fields sit at the top level.
pub(crate) fn push_stored_doc(&mut self, stored: &Value) {
- self.push_source(stored_source_view(stored));
+ self.push_vectors(stored_source_view(stored));
+ let identity = stored
+ .get("_id")
+ .and_then(Value::as_str)
+ .map(|id| DocIdentity {
+ id: id.into(),
+ seq_no: stored.get("_seq_no").and_then(Value::as_u64),
+ });
+ self.column.identities.push(identity);
}
/// Append a document given its source object.
pub(crate) fn push_source(&mut self, source: &Value) {
+ self.push_vectors(source);
+ self.column.identities.push(None);
+ }
+
+ fn push_vectors(&mut self, source: &Value) {
let doc = match self.mode {
ColumnMode::PooledOnly => self.push_pooled(source),
ColumnMode::BestPassage => match field_value_cow(source, &self.chunk_field) {
@@ -232,6 +279,66 @@ impl ColumnBuilder {
self.column.docs.push(doc);
}
+ /// Append one row of a segment's typed kNN projection (#1091): the same
+ /// document [`Self::push_stored_doc`] would have read, decoded straight to
+ /// `f32` by the storage layer instead of through `serde_json::Value`.
+ ///
+ /// The storage decoder converts each element with the same `as_f64()` then
+ /// `as f32` this builder uses, and refuses a column outright — the caller
+ /// falls back to the stored documents — whenever a cell holds anything the
+ /// `Value` path would have had to drop or skip (a non-number element, a
+ /// non-finite value, a passage that is not an array). So every row it does
+ /// hand over yields the entries `push_stored_doc` would have pushed:
+ /// `chunks` present wins in [`ColumnMode::BestPassage`], a passage keeps
+ /// its array index as its ordinal, and `None` is an absent or null cell.
+ pub(crate) fn push_projected(
+ &mut self,
+ id: Option<&str>,
+ seq_no: Option<u64>,
+ pooled: Option<&[f32]>,
+ chunks: Option<&[Vec<f32>]>,
+ ) {
+ let chunks = match self.mode {
+ ColumnMode::BestPassage => chunks,
+ ColumnMode::PooledOnly => None,
+ };
+ let doc = match (chunks, pooled) {
+ (Some(chunks), _) => {
+ let first = self.column.entries.len();
+ for (position, chunk) in chunks.iter().enumerate() {
+ let Ok(ordinal) = u32::try_from(position) else {
+ continue;
+ };
+ self.push_f32_vector(chunk, ordinal);
+ }
+ DocVectors::Chunks {
+ first,
+ count: self.column.entries.len() - first,
+ }
+ }
+ (None, Some(pooled)) => DocVectors::Pooled(self.push_f32_vector(pooled, 0)),
+ (None, None) => DocVectors::Absent,
+ };
+ self.column.docs.push(doc);
+ self.column.identities.push(id.map(|id| DocIdentity {
+ id: id.into(),
+ seq_no,
+ }));
+ }
+
+ fn push_f32_vector(&mut self, values: &[f32], ordinal: u32) -> usize {
+ let start = self.column.data.len();
+ self.column.data.extend_from_slice(values);
+ let norm = norm_f64(&self.column.data[start..]);
+ self.column.entries.push(VectorEntry {
+ start,
+ len: values.len(),
+ ordinal,
+ norm,
+ });
+ self.column.entries.len() - 1
+ }
+
fn push_chunks(&mut self, chunks: &[Value]) -> DocVectors {
let first = self.column.entries.len();
for (position, chunk) in chunks.iter().enumerate() {
@@ -415,6 +522,30 @@ mod tests {
assert_eq!(views(&column, 0), vec![(0, vec![1.0, 2.0])]);
}
+ #[test]
+ fn stored_documents_carry_their_identity_and_sources_do_not() {
+ let mut b = ColumnBuilder::new("v", ColumnMode::BestPassage);
+ b.push_stored_doc(&json!({"_id": "a", "_seq_no": 7, "_source": {"v": [1.0]}}));
+ b.push_stored_doc(&json!({"_id": "legacy", "v": [2.0]}));
+ b.push_stored_doc(&json!({"_id": 3, "_source": {"v": [3.0]}}));
+ b.push_source(&json!({"v": [4.0]}));
+ let column = b.finish();
+ assert_eq!(column.identity(0), Some(("a", Some(7))));
+ assert_eq!(column.identity(1), Some(("legacy", None)));
+ assert_eq!(column.identity(2), None, "a non-string _id is no candidate");
+ assert_eq!(column.identity(3), None, "a bare source has no identity");
+ assert_eq!(column.identity(99), None);
+ let mut scratch = ColumnBuilder::new("v", ColumnMode::BestPassage);
+ scratch.push_stored_doc(&json!({"_id": "a", "_source": {"v": [1.0]}}));
+ scratch.clear();
+ scratch.push_source(&json!({"v": [1.0]}));
+ assert_eq!(
+ scratch.column().identity(0),
+ None,
+ "clear forgets identities"
+ );
+ }
+
#[test]
fn dotted_vector_fields_resolve_through_get_field_value() {
let mut b = ColumnBuilder::new("emb.v", ColumnMode::BestPassage);
diff --git a/engine/crates/xerj-storage/src/stored_codec.rs b/engine/crates/xerj-storage/src/stored_codec.rs
index 2b0970682..997c42bc7 100644
--- a/engine/crates/xerj-storage/src/stored_codec.rs
+++ b/engine/crates/xerj-storage/src/stored_codec.rs
@@ -1315,6 +1315,32 @@ fn parse_v2_directory(body: &[u8]) -> Result<V2Directory<'_>> {
Ok(V2Directory { num_docs, columns })
}
+/// The `_source` column names of a columnar stored section (ZBS2, ZBS3 or
+/// ZBS4), in directory order, without decoding any payload; `None` for a
+/// legacy section. The identity columns `__id` and `__seq_no` are not
+/// `_source` fields and are left out. A caller that wants every field but a
+/// few can turn this into the include list
+/// [`decode_stored_v2_rows_projected`] takes.
+pub fn stored_v2_source_column_names(bytes: &[u8]) -> Result<Option<Vec<String>>> {
+ let bytes = if bytes.len() >= 4 && &bytes[..4] == STORED_V3_MAGIC {
+ split_stored_v3(bytes)?.1
+ } else {
+ bytes
+ };
+ if !is_columnar_stored_magic(bytes) {
+ return Ok(None);
+ }
+ let directory = parse_v2_directory(&bytes[4..])?;
+ Ok(Some(
+ directory
+ .columns
+ .iter()
+ .filter(|column| column.name != "__id" && column.name != "__seq_no")
+ .map(|column| column.name.to_string())
+ .collect(),
+ ))
+}
+
/// Decode only named columns from a V2 stored section.
///
/// This API does not change `decode_stored` or any engine behavior. It is the
@@ -3716,6 +3742,30 @@ mod tests {
}
}
+ #[test]
+ fn source_column_names_list_the_directory_without_identity_columns() {
+ let (_, encoded) = projection_fixture();
+ assert_eq!(
+ stored_v2_source_column_names(&encoded).unwrap(),
+ Some(vec![
+ "category".to_string(),
+ "embedding".to_string(),
+ "embedding_chunks".to_string(),
+ "large_unrequested".to_string(),
+ ])
+ );
+ let wrapped = wrap_stored_v3(encoded, vec![(0, 2)]);
+ assert_eq!(&wrapped[..4], STORED_V3_MAGIC);
+ assert_eq!(
+ stored_v2_source_column_names(&wrapped)
+ .unwrap()
+ .map(|names| names.len()),
+ Some(4)
+ );
+ let legacy = encode_stored_lz4(br#"[{"_id":"a","_seq_no":0,"_source":{}}]"#);
+ assert_eq!(stored_v2_source_column_names(&legacy).unwrap(), None);
+ }
+
#[test]
fn v2_projection_does_not_decode_unrequested_payload() {
let (_, mut encoded) = projection_fixture();