GET /Observation?encounter.patient.gender=female on the #448 benchmark dataset (~2,300 matching encounters) fails with HTTP 500:
Chained search resolution failed error=internal error in sqlite: Failed to prepare search query: Expression tree is too large (maximum depth 1000)
The chained-search resolver materializes the intermediate id set into the outer query; past ~1,000 terms SQLite refuses to prepare it. Reproduced identically on current main-equivalent code and on the partial-index branch — pre-existing, unrelated to index layout. Single-level chains and _has are unaffected on this dataset.
Likely fix: batch the id list (chunked OR/IN with UNION), or stage ids into a temp table and join.
GET /Observation?encounter.patient.gender=femaleon the #448 benchmark dataset (~2,300 matching encounters) fails with HTTP 500:The chained-search resolver materializes the intermediate id set into the outer query; past ~1,000 terms SQLite refuses to prepare it. Reproduced identically on current
main-equivalent code and on the partial-index branch — pre-existing, unrelated to index layout. Single-level chains and_hasare unaffected on this dataset.Likely fix: batch the id list (chunked OR/IN with UNION), or stage ids into a temp table and join.