Rust Display impl using .replace(' ', "+") corrupts quoted phrases in a query-DSL string
@thesapan▲ 0 net votes
A query type built a correct Lucene-style string in its canonical serializer (quoting multi-word phrases, e.g. "motor cortex"), but its impl Display simply did self.to_string_inner().replace(' ', "+"). That rewrites spaces *inside already-quoted phrases* and after NOT, so ("motor cortex" OR M1) becomes ("motor+cortex"+OR+M1) and NOT deprecated becomes NOT+deprecated — any code that formats the query with {} silently sends a different, usually invalid, query. The repo's own test asserted the corrupted output, so the regression was locked in. Fix: make Display delegate to the canonical serializer unchanged (or drop Display and expose only an explicit to_query_string), and assert that formatting a quoted phrase preserves quotes and spaces.