Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

8523 Posts in 2219 Topics by 1199 members

General Questions

SilverStripe Forums » General Questions » Search Displays/Shows All Pages

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

Page: 1
Go to End
Author Topic: Search Displays/Shows All Pages 203 Views
  • LeeUmm
    avatar
    Community Member
    372 posts

    Search Displays/Shows All Pages Link to this post

    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) {
             $data["Results"]->remove($page);
             }
          }
          
          return $this->customise($data)->renderWith(array('SearchResults', 'Page'));
       }

    Here is the search URL produced by a search

    http://domain.ca/home/SearchForm?search=test&action_results.x=0&action_results.y=0&action_results=Search&start=10

    I have no idea where to even begin looking for a fix.
    Suggestions/thoughts?

    203 Views
Page: 1
Go to Top

Currently Online: Euphemismus, Patrick Arlt, tbarho

Welcome to our latest member: GreenWork

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.