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   1263 Views

Avatar
corkg

Community Member, 30 Posts

5 July 2008 at 7:45am

Edited: 05/07/2008 7:46am

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

Forum Moderator, 474 Posts

5 July 2008 at 8:26am

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

Community Member, 30 Posts

5 July 2008 at 8:29am

thanks