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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Search Displays/Shows All Pages

Go to End



Community Member, 470 Posts

3 July 2009 at 8:16am

No matter what I search for, the search result page shows all my pages, even blank pages with no content.

Search was working fine, so something changed along the way as I've been making custom page types. How/why would this have anything to do with it?

Here is my search code which is pretty standard:

function SearchForm() {
		$searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
		$fields = new FieldSet(
	      	new TextField('Search', '', $searchText)
		$actions = new FieldSet(
	      	new FormAction('results', 'Search')

	  	return new SearchForm($this, 'SearchForm', $fields, $actions);
	function results($data, $form){
		$data = array(
			'Results' => $form->getResults(),
			'Query' => $form->getSearchQuery(),
			'Title' => 'Search Results'
		foreach($data["Results"] as $page) {
			if($page->Filename) {
		return $this->customise($data)->renderWith(array('SearchResults', 'Page'));

Here is the search URL produced by a search

I have no idea where to even begin looking for a fix.