Implementing research

with new research behaviour

refs #377 refs #223
This commit is contained in:
Julien Fastré 2014-12-31 02:33:27 +01:00
parent c22ba2c108
commit 3a9c1dcc07
3 changed files with 7 additions and 9 deletions

View File

@ -36,13 +36,11 @@ class SearchController extends Controller
{ {
public function searchAction(Request $request) public function searchAction(Request $request)
{ {
$searches = $this->get('chill.main.search_provider')->getByOrder(); $results = $this->get('chill.main.search_provider')
$results = array(); ->getResults($request->query->get('q'));
foreach ($searches as $search ) {
$results[] = $search->renderResult($request->get('q'));
}
return $this->render('ChillMainBundle:Search:list.html.twig', array('results' => $results) ); return $this->render('ChillMainBundle:Search:list.html.twig',
array('results' => $results)
);
} }
} }

View File

@ -46,7 +46,7 @@ interface SearchInterface #-> good name ?
* @param array $option the options, specific for each search * @param array $option the options, specific for each search
* @return string, an HTML string * @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, * we may desactive the search interface by default. in this case,

View File

@ -130,7 +130,7 @@ class SearchProvider
$terms = $this->parse($pattern); $terms = $this->parse($pattern);
$results = array(); $results = array();
foreach ($searchServices as $service) { foreach ($this->searchServices as $service) {
if ($service->supports($terms['_domain'])) { if ($service->supports($terms['_domain'])) {
$results[] = $service->renderResult($terms, $start, $limit); $results[] = $service->renderResult($terms, $start, $limit);
} }