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).
I just tried a slightly different approach using [url=http://doc.silverstripe.org/recipes:removingassetsfromsearch]this tutorial[/url]. But I get the same results. Apparently I fail at URLSegment. Any suggestions are greatly appreciated.
Using this function I should be removing the result found in mysite.com/otherpage/the_recipe, but it's not removing. I'm getting both results from the /recipes and /otherpage sections.
EDIT: So I now realize that URLSegment is returning the actual recipe page URLSegment. So that's why it's not filtering the page. So what I want would look like this, except this obviously doesn't work.