summaryrefslogtreecommitdiffstats
path: root/controllers
diff options
context:
space:
mode:
authorMichael Francis <edude03@gmail.com>2011-07-15 18:15:57 -0400
committerMichael Francis <edude03@gmail.com>2011-07-15 18:15:57 -0400
commitd6f1b4fb094acaa6b98843e746105aff3eb8735d (patch)
treef9635dfd824d03c7ebb61528d29f45f2d2d78cdb /controllers
parent657d270864c6f8f77d083fe4aa6ba636ecbbd372 (diff)
downloadotakuhub-d6f1b4fb094acaa6b98843e746105aff3eb8735d.tar.xz
Search across all content at once
Diffstat (limited to 'controllers')
-rw-r--r--controllers/SearchController.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/controllers/SearchController.php b/controllers/SearchController.php
index 421efb6..a7b0cee 100644
--- a/controllers/SearchController.php
+++ b/controllers/SearchController.php
@@ -12,9 +12,17 @@ class SearchController extends \lithium\action\Controller {
if (isset($this->request->query['q']))
{
$q = '/' . $this->request->query['q'] . '/i';
- return Anime::search($q, $page, 'title');
+ $conditions = array('title' => array('like' => $q));
+ $limit = 10;
+
+
+ $anime = Anime::find('all', compact('conditions', 'limit'));
+ $manga = Manga::find('all', compact('conditions', 'limit'));
+ $kdrama = Kdrama::find('all', compact('conditions', 'limit'));
+
+ return compact('anime', 'manga', 'kdrama');
+
}
- return $this->render(array('template' => 'index'));
}
public function anime($by = 'title')