public function indexAction(Request $request) {
        $page = $request->get("page", 1);
        $searchStr = $request->get("search");
        $type = $request->get("type");
        $em = $this->getDoctrine()->getManager();
        $query = $em->getRepository("AmulenMediaBundle:Gallery")->getQuerySearch($searchStr, $type);

        $paginator = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
                $query, $this->get('request')->query->get('page', $page));

        return array(
            'pagination' => $pagination,
            'searchStr' => $searchStr,
            'type' => $type,
        );
    }