Home > Back-end >  Combining fields in a Couchbase Spring-Data Query
Combining fields in a Couchbase Spring-Data Query

Time:02-23

I have a couchbase query that needs to search for a name, the object being searched stores firstName and lastName fields. My search query may be something like "Bob Smith", I have tried combining the fields in the query however this does not work ?

@Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} AND LOWER(firstName)   ' '   LOWER(lastName) LIKE $1 ")

CodePudding user response:

I can't comment on the Java syntax, but as far as the N1QL query:

I believe you are trying to concatenate LOWER(firstName) and LOWER(lastName) with a space in between? In that case, use the concatenate operator of || instead of .

  • Related