Allow more results from partial match search
Fix one wrinkle of the search that @athomas had when using the ~
operator:
@anoe Let me explain how this works: the original issue was that we discovered that for some words (like down
in Anne-Laure's example) are really considered stop words and thus not meaningful, so they are excluded by Postgres in a corpus search. However, it's sometimes useful to search for them (like down
, in the example).
What this MR is doing is switching to a different dictionary when we use the partial match ~
operator (and only in that case!), which means that queries that wouldn't yield any result, they do now.
However, we now need to use this operator sparingly as it's very powerful: for example it will match documents if you search for very common words like ~for
or even ~a
, I think, which might lead to very slow queries.
My recommendation is to give this MR a try without premature optimisation -- if performances are ever going to be a problem, there are other paths we can take, for example curating the list of stop words so that things like down
are not considered stopwords, and use these custom dictionaries in the ~
case.
This MR relies on this unmerged MR from opaleye-textsearch
: opaleye-textsearch!1 (merged)