src/Phlexible/Bundle/SearchBundle/Controller/SearchController.php
public function indexAction(Request $request)
    {
        $query = $request->get('query');
        $limit = $request->get('limit', 8);
        $start = $request->get('start', 0);

        $search = $this->get('phlexible_search.search');
        $results = $search->search($query);

        return new JsonResponse([
            'totalCount' => count($results),
            'results' => array_slice($results, $start, $limit),
        ]);
    }
public function indexAction(Request $request)
    {
        $query = $request->get('query');
        $limit = $request->get('limit', 8);
        $start = $request->get('start', 0);

        $search = $this->get('phlexible_search.search');
        $results = $search->search($query);

        return new JsonResponse([
            'totalCount' => count($results),
            'results' => array_slice($results, $start, $limit),
        ]);
    }
public function indexAction ( Request $ request ) { $ query = $ request -> get ( 'query' ) ; $ limit = $ request -> get ( 'limit' , 8 ) ; $ start = $ request -> get ( 'start' , 0 ) ; $ search = $ this -> get ( 'phlexible_search.search' ) ; $ results = $ search -> search ( $ query ) ; return new JsonResponse ( [ 'totalCount' => count ( $ results ) , 'results' => array_slice ( $ results , $ start , $ limit ) , ] ) ; }
Return search results.

@param Request $request

@return JsonResponse
@Route("", name="search_search")
@Method({"GET", "POST"})
@ApiDoc(
description="Search",
requirements={
{"name"="query", "dataType"="string", "required"=true, "description"="Search query"}
},
filters={
{"name"="limit", "dataType"="integer", "default"=8, "description"="Limit results"},
{"name"="start", "dataType"="integer", "default"=0, "description"="Result offset"}
}
)
Return search results .