$page->search($query, $params = array())

Searches all descendants

  • $query (string)
    The search term
  • $params (string | array)
  • return ($pages)

Example

// search the entire site
$results = $site->search('my awesome search');

// search all children, children of children, etc. of the current page
$results = $page->search('my awesome search');

// filter the search results
$results = $page->search('my awesome search')->visible()->filterBy('template', 'article');

// add pagination to the search results
$results = $page->search('my awesome search')->paginate(20);

// search in certain fields only
$results = $page->search('my awesome search', 'title|text');

// search for full words only
$results = $page->search('my awesome->search', array('words' => true));

// feed the search with a get parameter -> http://yourdomain.com/?q=awesome
$results = $page->search(get('q'));