Searching for people’s names is hard. Names aren’t like other text; when the algorithm finds a match on a person’s name, it’s a much stronger signal of relevance than matching on a normal word.
For example, if you searched “doctor singh cardiology”, the word “singh” matters a lot more than the word “cardiology” or “doctor”. This user is asking about a specific person, not all cardiologists.
The best way to handle this in Answers is to use a combination of our new phraseMatch
algorithm along with textSearch
. Specifically, we recommend using phraseMatch
first names and last names and textSearch
on the full name, like so:
Or in JSON, if you prefer:
{
"verticals": {
"people": {
"searchableFields": {
"name": {"textSearch": true},
"firstName": {"phraseMatch": true},
"lastName": {"phraseMatch": true}
}
}
}
}
In general, this will work better than using textSearch
alone because it will prioritize matches on first and last name over matches on other fields and boost those results to the top. It will also work better than using nlpFilters
since they can be too exclusionary.
For example, if a name is both someone’s first name and last name - like Lincoln Riley and Abraham Lincoln - then the algorithm will get confused when someone searches for “what is lincoln’s phone number”.
You can learn more about phraseMatch
and other searchable fields in the Vertical Searchable Fields unit.