Full text search with N1QL query gives incorrect and inconsistent response

While running FTS search requests from N1QL, we added a constraint that for non-analytic queries - the FTS index definition will need those fields to be indexed with the “keyword” analyzer. This is for strict consistency when N1QL needs to evaluate documents that it obtains directly from the database.

The keyword analyzer stores the content of the field exact as is (case sensitive).

The wildcard query is one such non-analytic query, you’ll need to the field extension to be indexed using the keyword analyzer to support your search from N1QL.

When you search without the wildcard, a match query (which is an analytic query) runs and works of the analyzer you’ve defined in the index definition. The default is standard which tokenizes text on unicode and applies the lower case filter over those tokens before indexing them. This is the reason why PDF is considered a match when you look for pdf.

1 Like