Thanks for that Barry! That's what I'm looking for, but I don't think I understand the URLSegment part well enough to make my query work properly.
To test is I set up two pages that had "Salad" in their title. One page inside the /recipes section and one outside. With the query below I'm returning both, but I only want the one inside the /recipes section. I was able to get mixed results filtering by Title and Name, but URLSegment is definitely what I want to filter by.
Actually...What would be preferable would be something like this:
$doResult->URLSegment == "$TheCurrentSegment"
where "TheCurrentSegment" is the section I'm searching in (ie. the recipes section).
Any idea?
// search
function results($data, $form) {
$dosResults = $form->getResults();
$dosNewResults = new DataObjectSet();
foreach ($dosResults as $doResult) {
if ($doResult->URLSegment == "recipes")
{
// filtered
} else {
// unfiltered
$dosNewResults->push($doResult);
}
}
$data = array(
'Results' => $dosNewResults,
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);
$this->Query = $form->getSearchQuery();
return $this->customise($data)->renderWith(array('ArticleSearchResults', 'ArticleHolder'));
}