I have a document type that contains an array of objects about a person, one of which is their name. For example:
"creators":[
{
"id":"john.doe",
"name":"John Doe"
},
{
"id":"jane.smith",
"name":"Jane Smith"
}
]
I want to have a filter that limits search results based on user input matching creators.name
. Currently, I'm using the term
filter. However, the standard analyzer only creates tokens for (to use the first example) "John" and "Doe", but NOT "John Doe", so my current method only works for "John" or "Doe", but not "John Doe". I considered using the terms
filter instead and parsing the input based on whitespace, but then that would also match "John Smith", which is not ideal.
Is there a different way I should be querying, or do I need to use a different analyzer that would also treat "John Doe" as a token? And would these approaches properly address people with more than 2 names? Thanks.