summaryrefslogtreecommitdiffstats
path: root/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'controllers')
-rw-r--r--controllers/SearchController.php11
1 files changed, 5 insertions, 6 deletions
diff --git a/controllers/SearchController.php b/controllers/SearchController.php
index 805b981..0052992 100644
--- a/controllers/SearchController.php
+++ b/controllers/SearchController.php
@@ -11,16 +11,15 @@ class SearchController extends \lithium\action\Controller {
public function index() {
if (isset($this->request->query['q']))
{
- $q = '/' . $this->request->query['q'] . '/i';
- $conditions = array('title' => array('like' => $q));
- $limit = 10;
-
+ $q = $this->request->query['q'];
+ $conditions = array('title' => array('like' => "/$q/i"));
+ $limit = 7;
$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 compact('q', 'anime', 'manga', 'kdrama');
}
}