1

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 ")
  • Would you please mention what's happening and what you expect to happen, along with error messages? "does not work" is pretty vague. – Matthew Groves Feb 22 '22 at 18:05

1 Answers1

0

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 +.

Matthew Groves
  • 25,181
  • 9
  • 71
  • 121