Does Full Text Search support the "contains" search type?

Does it support a search type like “CONTAINS” using full text search? We can do this in sql as follows:

'LIKE %test%'

But I couldn’t see anything like that in Full Text Search. At the moment, I was only able to get it to work as “startsWith”. For this I have code like this:

'searchText*'

However, I need to search like “CONTAINS”.

use regexp - '.*searchText.*'

https://docs.couchbase.com/server/current/fts/fts-supported-queries-regexp.html

That is one solution, the link is for server but mobile also handles regular expressions. Does *searchText* not work also?

as you said this is for server. And already not worked..*searchText.*

i also tried *searchText* didn’t work…

And already not worked..*searchText.*

If you used “.searchText.” as “match”, yes, it won’t work. It’s regex.
Can you show us what you tried?

I tried like that. FullTextFunction.match(indexName, “.*searchText.*”)

The second parameter of the FullTextFunction.match() function expects a string.

I was expecting that FullTextFunction would have a regex() method (analogous to regexp in server). Apparently it doesn’t.
There is a regex() method on Expression for query
https://docs.couchbase.com/mobile/2.0/couchbase-lite-java/db022/com/couchbase/lite/Expression.html

How do I use regexExpression here when the second parameter of FullTextFunction.match() expects a string?

Use Expression.regex() instead (?)

As you can see here, the FullTextFunction.Match() function takes two parameters and they are both strings. I couldn’t find a place to write Expression.regex here

Expression.regex() is not something you are using with FullTextFunction’s match(). Basically, use Expression.regex() instead of FullTextFunction’s match()