The code-cited query joined every embedding to langchain_pg_collection before filtering, and matched codes with no index to help it; it now filters on a scalar collection_id subquery, and ensure_hnsw builds a GIN index over the codes array plus one on collection_id. The DuckDB replica is opened once and kept, reopened only when publish_replica swaps the file (mtime_ns). Prompt size: at most two vintages once a question touches more than three codes, and code-cited snippets cap at 250 chars.
2.1 KiB
2.1 KiB