From 3a9c1dcc072b1e518814c058fbb7ac867201950f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 31 Dec 2014 02:33:27 +0100 Subject: [PATCH] Implementing research with new research behaviour refs #377 refs #223 --- Controller/SearchController.php | 12 +++++------- Search/SearchInterface.php | 2 +- Search/SearchProvider.php | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Controller/SearchController.php b/Controller/SearchController.php index 280292082..110cc98dc 100644 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -36,13 +36,11 @@ class SearchController extends Controller { public function searchAction(Request $request) { - $searches = $this->get('chill.main.search_provider')->getByOrder(); - $results = array(); - - foreach ($searches as $search ) { - $results[] = $search->renderResult($request->get('q')); - } + $results = $this->get('chill.main.search_provider') + ->getResults($request->query->get('q')); - return $this->render('ChillMainBundle:Search:list.html.twig', array('results' => $results) ); + return $this->render('ChillMainBundle:Search:list.html.twig', + array('results' => $results) + ); } } \ No newline at end of file diff --git a/Search/SearchInterface.php b/Search/SearchInterface.php index 80d07871c..5497782a4 100644 --- a/Search/SearchInterface.php +++ b/Search/SearchInterface.php @@ -46,7 +46,7 @@ interface SearchInterface #-> good name ? * @param array $option the options, specific for each search * @return string, an HTML string */ - public function renderResult($terms, $start=0, $limit=50, array $options = array()); + public function renderResult(array $terms, $start=0, $limit=50, array $options = array()); /** * we may desactive the search interface by default. in this case, diff --git a/Search/SearchProvider.php b/Search/SearchProvider.php index 9d02a3f10..4144298ec 100644 --- a/Search/SearchProvider.php +++ b/Search/SearchProvider.php @@ -130,7 +130,7 @@ class SearchProvider $terms = $this->parse($pattern); $results = array(); - foreach ($searchServices as $service) { + foreach ($this->searchServices as $service) { if ($service->supports($terms['_domain'])) { $results[] = $service->renderResult($terms, $start, $limit); }