FTS Query, Logical AND, Wildcards, and stop words causes "Malformed search string" exception

When I FTS search with a string like so: “anything* AND stopword*”, the query execution fails with a SQLite error saying the query was given a “malformed search string”.

Some examples:
“usfs* AND he*”
“banana* AND she*”
“orange* AND i*”

I’m guessing this is caused by stop words (common English words) being extracted from the search string before taking logical operands and wildcards into account, resulting in:
“usfs* AND *”
“banana* AND *”
“orange* AND *”

All of which are indeed “malformed search strings”. Because I don’t need any stemming or NLP features, I just set the index language to null, and the issue went away, so my problem is solved, but I figured I’d make a post as this is some very odd behavior!

Setting to nil disables the language features. By default, stop words are ignored - assuming your current locale’s language was english (if you hadn’t set it explicitly).
But IIRC it will still tokenize on unicode whitespace…

What’s the exact error you get? This sounds like a bug in CBL.

I’ve filed this as https://github.com/couchbase/couchbase-lite-core/issues/626