Like Query on Concatenation of two fields in Couchbase Lite




We have to create a like query on the concatenation of two fields, say First Name and Last Name on Couchbase Lite 2.1.

We are using the below query and not getting any results.
Can anyone please help.

We are using the query given below :-

String searchTerm = “%Harsh Mehlawat%”;
Query query =“ID”))
.add(Expression.string(" ")


add is for numeric operations. There is no string concatenation operator in the query builder yet. I’d suggest doing the reverse and parsing the first and last name out of the search term and then using an and operation.


we may also want to add middle name in between which will make complexity higher and produce unwanted result. Secondly search term will not be having complete data.

Better we can have a field in the document as fullName which can be concatenated while saving the data. Which makes everything easy.


Should become a priority feature. Along with unnest functionality.

@househippo, @priya.rajagopal, @jens should I create a ticket for this. Or it is already in backlog.

Pankaj Sharma


The concatenation operator already exists in couchbase-lite-core; we’d just need to add it to the public query-builder API.


Our API issue tracker isn’t public, but I’ve just filed this as an issue.


Thank you @jens . Have you filed issue for both unnest and concatenation?


Unnest is already in development.


Please file both UNNEST and concatenation requests with specific use case description through the Accounts team. They are on our radar but your request will help with the prioritization.