There is a search page on the site, so site visitors can search stuff either by city or/and by name. So the city is a drop down filter and the name search is a PartialMatchFilter text field.
The PartialMatchFilter works fine with one part of name being searched eg Tim or Smith, then Tim Glen Smith shows up. The issue I'm having is when you seach Tim Smith, it says no match because I missed Glen in the middle.
Can PartialMatchFilter work for this case when people don't know the middle name of the person? How is the best way to do it? Thanks.
Below is the code.
$filters = array (
'YourName' => new PartialMatchFilter("YourName"),
'YourCity' => new ExactMatchMultiFilter("YourCity"),
}
PartialMatchFilter is the equivalent of
WHERE FieldName LIKE '%{$your_input}%'
so will only ever match the exact string somewhere in the field.
In order to be able to search for multiple words within the field, you'd be better off using FullTextFilter.
I think you need to replace the whitespace in your search criteria with a percent sign
eg "Tim Smith" becomes "Tim%Smith"
Then the partial match filter should be able to find the right records.