Created
October 14, 2013 09:00
-
-
Save dwaligora/6972944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Nexus\Media\FrontendBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | |
/** | |
* Class MediaSearchController | |
* @package Nexus\Media\FrontendBundle\Controller | |
* @Route("/search") | |
*/ | |
class MediaSearchController extends Controller | |
{ | |
/** | |
* @Route("/clips/{slug}",name="nexus_media.frontend.media_search.search_clips", options={"expose"=true}) | |
* @Template() | |
*/ | |
public function searchClipsAction($slug) | |
{ | |
$query = \Elastica_Query::create($slug); | |
$query->setFilter(new \Elastica_Filter_Term(array('published' => true))); | |
$query->addSort(array( | |
'publication_date' => array( | |
'order' => 'desc' | |
), | |
) | |
); | |
$finder = $this->get('fos_elastica.finder.nexus_media.clip'); | |
$results = $finder->findHybrid($query, 3 * 3); | |
return array('results' => $results, 'query' => $slug); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment