Reputation: 601
I have a custom search with SilverStripe 3.5.6, that explodes into an array all the keywords, and only returns results that contains all of the words, not the ones that contain one of the words.
This is just a small piece of the script, but this is how I use the filter function.
foreach($keywords as $keyword) {
$search_terms_title['Title:PartialMatch'][] = $keyword;
}
Page::get()->filter($search_terms_title)
Upvotes: 0
Views: 111
Reputation: 3318
You could build up each filter, adding many AND Title LIKE '%keyword%'
where clauses as follows:
$pages = Page::get()
foreach($keywords as $keyword) {
$pages = $pages->filter('Title:PartialMatch', $keyword);
}
Upvotes: 1