mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Why this change? Since1dba1aca27, we have been remapping the `<->` proximity operator in a tsquery to `&`. However, there is another variant of it which follows the `<N>` pattern. For example, the following text "end-to-end" will eventually result in the following tsquery `end-to-end:* <-> end:* <2> end:*` being generated by Postgres. Before this fix, the tsquery is remapped to `end-to-end:* & end:* <2> end:*` by us. This is requires the search data which we store to contain `end` at exactly 2 position apart. Due to the way we limit the number of duplicates in our search data, the search term may end up not matching anything. Inbd32912c5e, we made it such that we do not allow any duplicates when indexing a topic's title. Therefore, search for `end-to-end` against a topic title with `end-to-end` will never match because our index will only contain one `end` term. What does this change do? We will remap the `<N>` variant of the proximity operator.