In the JSON format provided below, I have stored a person's first name and last name along with their nickname.
{
"Person": {
"Records": [
{
"nameType": "Primary",
"firstName": "Sagar",
"lastName": "Dravid"
},
{
"nameType": "known as",
"firstName": "Bunny",
"lastName": "Bhau"
}
]
}
}
For a typeahead search API I am developing, I need to combine both the first name and last names. I am currently able to search on individual fields such as either the first name or last name. Below is the code snippet I've tried:
.where(cts.jsonPropertyValueQuery("firstName", [str + "* *"], ["wildcarded","punctuation-insensitive","diacritic-insensitive","unstemmed","case-insensitive"]))
.map(mapper)
.withOptions({
search: ['filtered']
})
.result();
How can I concatenate the JSON fields to achieve a complete name search So that when a user types "Sagar Dravid" or "Bunny Bhau", they should get results, but not if they type "Sagar Bhau" or "Bunny Dravid". Any suggestions?