$pages->search($query, $params = array())
Searches all pages in the collection and all descendants
-
$query (string)
The search term -
$params (string | array)
See examples below -
return ($pages)
Parameter options and defaults
$defaults = array(
'minlength' => 2,
'fields' => array(),
'words' => false,
'score' => array()
);
```
## Examples
```php
// search all pages and descendants
$results = $pages->search('my awesome search');
// filter the search results
$results = $pages->search('my awesome search')->visible()->filterBy('template', 'article');
// add pagination to the search results
$results = $pages->search('my awesome search')->paginate(20);
// search in certain fields only
$results = $pages->search('my awesome search', 'title|text');
// search for full words only
$results = $pages->search('my awesome->search', array('words' => true, 'minlength' => 4));
// feed the search with a get parameter -> http://yourdomain.com/?q=awesome
$results = $pages->search(get('q'));