Match/wildcard search using full text search feature for a field with String of Arrays is not working

Hello Team,

We would like to use the new FTS feature available in 7.X version of Couchbase Enterprise Server. When we are playing around with a document containing a field of type “string” the match query works fine with partial match of text in String. But when we apply the same for the field of type “array” containing list of String. It’s not working. However it is working as an exact match of the text. Our expectation is that it should also fetch the documents with partial match. Below is the example provided what we are trying in our System.

JSON Document-1:
{
  "tags": ["Couchbase FTS", "Full Text Search", "Tokenizer Example"]
}
JSON Document-2:
{
  "tags": ["Couchbase Query", "Full Text Search", "Tokenizer Example"]
}

Query used to find the documents matching String “base”

{"query":{ "match": "base", "field": "tags" }}

In return we are getting the following message from the Server
“No results found for your query.
Please check your search term(s) and/or use the syntax help link under the search field”

Would you mind posting more details about the FTS index that you’ve created?

Hi @Gnanamuthu Just a quick comment it will certainly match

{"query":{ "match": "couchbase", "field": "tags" }}

The token “couchbase” is not split into two words. Perhaps you want a Regex (note the syntax is golang)

{"query":{ "regexp": ".+base", "field": "tags" }}

The above should work for you if you are using the default analyzer. For more details on RegEx search queries you can look at this post: FTS matching an exact word of a format "aaaa:100@143" - #7 by flaviu

I hope this helps

Best

Jon Strabala
Principal Product Manager - Server‌

Try using a custom analyzer with a whitespace tokenizer and ngram token filter (for e.g min:4, max:10) along with the to_lower token filter (for case insensitive search) - Create a Custom Token Filter | Couchbase Docs for the field tags.

Your search request can remain exactly as is.