("imprtant" OR "important" OR "importance") AND ("invstmet" OR "investment" OR "investments")
To make a query like this we either need support for enhanced query syntax (for paranthesis) or break the single FTS query into multiple queries (one each for the fuzzy matches of a word), which will be slower.
Unfortunately, the pre-compiled sqlite that we use does not support enhanced query syntax, so we'd either need to provide an sqlite with the required support or split the query.
Edit: Another way would be to filter the result of
"imprtant" OR "important" OR "importance" OR "invstmet" OR "investment" OR "investments",
depending on whether any:1 is present or not, to get notes that contain all the search words. I'm working on this.
Spellfix can return a score that indicates its "fuzziness". (Smaller the better)
https://www.sqlite.org/spellfix1.html#virtual_table_details
I'm sorting the notes by their min fuzziness score as explained in the spec.
And yes, I have integrated this into the existing BM25 logic.