Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Search


Reply

3 Posts   1243 Views

Avatar
corkg

5 July 2008 at 7:45am (Last edited: 5 July 2008 7:46am), Community Member, 30 Posts

How can I restrict the search to only level 2 and 3 pages like the Menu(2), so if

Home
---Food
------Food1
---Special Food
------Food 1
------Food 2
About Food

it would only show

---Food
------Food1
---Special Food
------Food 1
------Food 2

Avatar
simon_w

5 July 2008 at 8:26am Forum Moderator, 474 Posts

In the CMS, you can make a page not show up in searches.

Alternatively, you could create a subclass of SearchForm, where you override searchEngine() to something like:

public function searchEngine($keywords, $numPerPage = 10, $sortBy = "Relevance DESC", $extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false) {
return parent::searchEngine($keywords, $numPerPage, $sortBy, "SiteTree.ParentID = 0", $booleanSearch, $alternativeFileFilter, $invertedMatch);
}


Then use that class instead of SearchForm.

Avatar
corkg

5 July 2008 at 8:29am Community Member, 30 Posts

thanks