Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Created August 22, 2014 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastianallgeier/b5c5d5f5dea1d2bbcb7b to your computer and use it in GitHub Desktop.
Save bastianallgeier/b5c5d5f5dea1d2bbcb7b to your computer and use it in GitHub Desktop.
<?php
// 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'));
// and much more!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment