Displays the terrific component search.

@Route("/search", name="composer_search")
@Template()

@param Request $request
@return Response
774853
public function searchAction(Request $request)
    {
        // get all modules
        $moduleManager =  $this->get('terrific.composer.module.manager');
        $modules = $moduleManager->getModules();

        // get all pages
        $pageManager =  $this->get('terrific.composer.page.manager');
        $pages = $pageManager->getPages();

        // merge the results
        $results = array_merge($modules, $pages);

        return array('results' => $results);
    }
1017955
public function listAction(Request $request)
	{
		$rootNodes = array();

		$repo = $this->container->getDoctrine()
			->getManager()->getRepository('Supra\Package\Cms\Entity\Abstraction\File');

		$output = array();

		// if parent dir is set then we set folder as rootNode
		if ($request->query->get('id')) {
			$node = $this->getFolder('id');
			$rootNodes = $node->getChildren();
		} else {
			$rootNodes = $repo->getRootNodes();
		}

		foreach ($rootNodes as $rootNode) {
			/* @var $rootNode FileAbstraction */

			if ($request->query->get('type')) {

				$itemType = $this->getEntityType($rootNode);
				$requestedType = $request->query->get('type');

				if ( ! (
					($itemType == $requestedType) ||
					($itemType == Folder::TYPE_ID)
				)) {
					continue;
				}
			}

			$item = $this->entityToArray($rootNode);

			if ($rootNode instanceof File) {

				$extension = mb_strtolower($rootNode->getExtension());

				$knownExtensions = $this->container->getParameter('cms.media_library_known_file_extensions');
				if (in_array($extension, $knownExtensions)) {
					$item['known_extension'] = $extension;
				}

				$checkExistance = $this->container->getParameter('cms.media_library_check_file_existence');
				if ($checkExistance == self::CHECK_FULL) {
					$item['broken'] = ( ! $this->isAvailable($rootNode));
				}
			}

			// Get thumbnail
			if ($rootNode instanceof Image) {
				// create preview
				// TODO: hardcoded 30x30
				try {
					if ($this->getFileStorage()->fileExists($rootNode)) {
						$sizeName = $this->getFileStorage()->createResizedImage($rootNode, 30, 30, true);
						if ($rootNode->isPublic()) {
							$item['thumbnail'] = $this->getFileStorage()->getWebPath($rootNode, $sizeName);
						} else {
							$item['thumbnail'] = $this->getPrivateImageWebPath($rootNode, $sizeName);
						}
					}
				} catch (\Exception $e) {
					$item['broken'] = true;
				}
			}

			$output[] = $item;
		}

		return new SupraJsonResponse(array(
			'totalRecords' => count($output),
			'records' => $output,
		));
	}
131738
public function searchAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()
            ->getResponse(['AnimeDbCatalogBundle:Item', 'AnimeDbCatalogBundle:Storage']);
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $form Form */
        $form = $this->createForm('animedb_catalog_search', new SearchEntity())->handleRequest($request);
        $pagination = null;
        $result = ['list' => [], 'total' => 0];

        if ($form->isValid()) {
            /* @var $controls ListControls */
            $controls = $this->get('anime_db.item.list_controls');

            // current page for paging
            $current_page = $request->get('page', 1);
            $current_page = $current_page > 1 ? $current_page : 1;

            // get items limit
            $limit = $controls->getLimit($request->query->all());

            // do search
            $result = $this->get('anime_db.item.search')->search(
                $form->getData(),
                $limit,
                ($current_page - 1) * $limit,
                $controls->getSortColumn($request->query->all()),
                $controls->getSortDirection($request->query->all())
            );

            if ($limit) {
                // build pagination
                $that = $this;
                $query = $request->query->all();
                unset($query['page']);
                $pagination = $this->get('anime_db.pagination')
                    ->create(ceil($result['total'] / $limit), $current_page)
                    ->setPageLink(function ($page) use ($that, $query) {
                        return $that->generateUrl('home_search', array_merge($query, ['page' => $page]));
                    })
                    ->setFirstPageLink($this->generateUrl('home_search', $query))
                    ->getView();
            }
        }

        return $this->render('AnimeDbCatalogBundle:Home:search.html.twig', [
            'form' => $form->createView(),
            'items' => $result['list'],
            'total' => $result['total'],
            'pagination' => $pagination,
            'searched' => (bool) $request->query->count(),
        ], $response);
    }
1003458
public function listAction(Request $request)
    {
        $query = $this->addOrganizationFilter($request->query->all());

        return new JsonResponse($this->finder->search(
            $this->getClass(),
            $query,
            []
        ));
    }
1176843
public function indexAction(Request $request)
    {
        $query = htmlspecialchars($request->query->get('q'));

        $queryMinLength = $this->getParameter('darvin_admin.search_query_min_length');

        $queryTooShort = mb_strlen($query) < $queryMinLength;

        $entityNames = $queryTooShort ? [] : $this->getSearcher()->getSearchableEntityNames();

        return $this->render('DarvinAdminBundle:Search:index.html.twig', [
            'entity_names'     => $entityNames,
            'query'            => $query,
            'query_min_length' => $queryMinLength,
            'query_too_short'  => $queryTooShort,
        ]);
    }
259310
public function browse(Request $request, $filter = null)
    {
        $this->template = 'layouts.component';
        $this->filter   = $filter;

        return $this->index($request);
    }
889792
public function audioAction(Request $request)
    {
        $params = $request->request->all();

        unset($params['module']);
        unset($params['controller']);
        unset($params['action']);

        $previewer = $this->get('phlexible_media_template.previewer.audio');
        $locator = $this->get('file_locator');

        $filePath = $locator->locate('@PhlexibleMediaTemplateBundle/Resources/public/audio/test.mp3', null, true);
        $data = $previewer->create($filePath, $params);

        return new ResultResponse(true, 'Preview created', $data);
    }
802583
public function indexAction(Request $request)
    {
        $query = $request->query->get('query');
        $limit = $request->query->get('limit');
        $start = $request->query->get('start');

        $searchProviders = $this->get('search.providers');

        $content = '';
        $content .= '<h3>Registered Search Providers:</h3><table><tr><th>Class</th><th>Resource</th><th>Search key</th></tr>';
        foreach ($searchProviders as $searchProvider) {
            $content .= '<tr>';
            $content .= '<td>'.get_class($searchProvider).'</td>';
            $content .= '<td>'.$searchProvider->getResource().'</td>';
            $content .= '<td>'.$searchProvider->getSearchKey().'</td>';
            $content .= '</tr>';
        }
        $content .= '</table>';

        $content .= '<h3>Search:</h3>';
        $content .= '<form><input name="query" value="'.$query.'"/><input type="submit" value="send" /></form>';

        if ($query) {
            $content .= '<h3>Results:</h3>';
            $search = $this->getContainer()->get('search.search');
            $results = $search->search($query);
            $content .= '<pre>';
            $content .= print_r($results, true);
            $content .= '</pre>';
        }

        return new Response($content);
    }
671136
public function search(Request $request)
    {
        $features = $this->service->search($request->search, null);
        return view('admin.features.index')->with('features', $features);
    }
1075806
public function index(Request $request)
	{
		//I need to come back in here and check how I can sync the paginated products
		//with the filters. The issue here is paginated does not contain the whole
		//result, therefore, the filters count are worng.

		$products = $this->products->filter(
			$request->all()
		);

		// this line is required in order for the store to show
		// the counter on the side bar filters.
		$allProducts = $products->get();

		if (Auth::check()) {
			Auth::user()->updatePreferences('my_searches', $allProducts);
		}

		return view('products.index', [
			'suggestions' => Suggestions\Suggest::shakeFor($allProducts),
			'refine' => Parsers\Breadcrumb::parse($request->all()),
			'filters' => Parsers\Filters::parse($allProducts),
			'products' => $products->paginate(28),
			'panel' => $this->panel,
		]);
	}
342103
public function indexAction(Request $request)
    {
        $manager = $this->get('compo_faq.manager.faq');

        $page = $request->get('page', 1);

        $pager = $manager->getPager([], $page);
        $totalPages = $pager->getPageCount();

        $seoPage = $this->get('sonata.seo.page');
        $seoPage->setContext('faq_list');
        $seoPage->addVar('page', $page);
        $seoPage->addVar('total_pages', $pager->getPageCount());

        if (1 !== $page) {
            $seoPage->setLinkCanonical($manager->getFaqIndexPermalink(['page' => $page], 0));
            $metas = $seoPage->getMetas();
            $metas['name']['robots'] = 'noindex, follow';
            $seoPage->setMetas($metas);
        } else {
            $seoPage->setLinkCanonical($manager->getFaqIndexPermalink([], 0));
        }

        if ($totalPages > 1 && $page < $totalPages) {
            $seoPage->setLinkNext($manager->getFaqIndexPermalink(['page' => $page + 1], 0));
        }

        if ($totalPages > 1 && $page > 1) {
            $seoPage->setLinkPrev($manager->getFaqIndexPermalink(['page' => $page - 1], 0));
        }

        $seoPage->build();

        return $this->render(
            'CompoFaqBundle:Faq:index.html.twig',
            [
                'pager' => $pager,
            ]
        );
    }
987481
public function search(Request $request, array $contenttypes = null)
    {
        $q = '';
        $context = __FUNCTION__;

        if ($request->query->has('q')) {
            $q = $request->query->get('q');
        } elseif ($request->query->has($context)) {
            $q = $request->query->get($context);
        }
        $q = Input::cleanPostedData($q, false);

        $page = $this->app['pager']->getCurrentPage($context);

        // Theme value takes precedence over default config @see https://github.com/bolt/bolt/issues/3951
        $pageSize = $this->getOption('theme/search_results_records', false);
        if ($pageSize === false && !$pageSize = $this->getOption('general/search_results_records', false)) {
            $pageSize = $this->getOption('theme/listing_records', false) ?: $this->getOption('general/listing_records', 10);
        }

        $offset = ($page - 1) * $pageSize;
        $limit = $pageSize;

        // set-up filters from URL
        $filters = [];
        foreach ($request->query->all() as $key => $value) {
            if (strpos($key, '_') > 0) {
                list($contenttypeslug, $field) = explode('_', $key, 2);
                if (isset($filters[$contenttypeslug])) {
                    $filters[$contenttypeslug][$field] = $value;
                } else {
                    $contenttype = $this->getContentType($contenttypeslug);
                    if (is_array($contenttype)) {
                        $filters[$contenttypeslug] = [
                            $field => $value,
                        ];
                    }
                }
            }
        }
        if (count($filters) == 0) {
            $filters = null;
        }

        $isLegacy = $this->getOption('general/compatibility/setcontent_legacy', true);
        if ($isLegacy) {
            $result = $this->storage()->searchContent($q, $contenttypes, $filters, $limit, $offset);

            /** @var \Bolt\Pager\PagerManager $manager */
            $manager = $this->app['pager'];
            $manager
                ->createPager($context)
                ->setCount($result['no_of_results'])
                ->setTotalpages(ceil($result['no_of_results'] / $pageSize))
                ->setCurrent($page)
                ->setShowingFrom($offset + 1)
                ->setShowingTo($offset + ($result ? count($result['results']) : 0));
            ;

            $manager->setLink($this->generateUrl('search', ['q' => $q]) . '&page_search=');
        } else {
            $appCt = array_keys($this->app['query.search_config']->getSearchableTypes());
            $textQuery = '(' . join(',', $appCt) . ')/search';
            $params = [
                'filter' => $q,
                'page'   => $page,
                'limit'  => $pageSize,
            ];
            $searchResult = $this->getContent($textQuery, $params);

            $result = [
                'results' => $searchResult->getSortedResults(),
                'query'   => [
                    'sanitized_q' => strip_tags($q),
                ],
            ];
        }

        $globals = [
            'records'      => $result['results'],
            $context       => $result['query']['sanitized_q'],
            'searchresult' => $result,
        ];

        $template = $this->templateChooser()->search();

        return $this->render($template, [], $globals);
    }
1305010
protected function searchSelect2(Request $request, $class, $fieldSearchFunction = 'title', $renderResult = null)
    {
        // 3rd parameter: use the following code to have a more flexible search
        // $querySearch = function(\Doctrine\ORM\QueryBuilder $queryBuilder, $query) {
        //     $queryBuilder
        //          ->andWhere("o.{{ property }} LIKE :{{ property }}")
        //          ->setParameter("{{ property }}","%$query%");
        //  };

        // 4th parameter: use the following code to customize rendering of select2
        // $twig = $this->get('twig');
        // $html = $this->bundle_name.":Admin/".strtolower(substr($class,strripos($class,'\\')+1)).":renderResultSelect2.html.twig";
        // $appendResult = function( $entity, $query) use ($twig, $html) {
        //     return [
        //         'renderValue'    => $twig->render($html, ['entity' => $entity, 'query' => $query]),
        //          'text'          => $entity->__toString(),
        //          'id'            => $entity->getId()
        //      ];
        //  };

        $query = $request->get('q', null);
        $limit = (int) $request->get('page_limit', 10);
        $page = (int) $request->get('page', 1);

        $res = ['term' => $query, 'more' => false, 'results' => []];

        // creation du queryBulider
        $queryBuilder = $this->get('doctrine.orm.entity_manager')
            ->getRepository($class)
            ->createQueryBuilder('o')
        ;

        // add filters
        if (is_string($fieldSearchFunction)) {
            $queryBuilder
                ->andWhere("o.$fieldSearchFunction LIKE :$fieldSearchFunction")
                ->setParameter("$fieldSearchFunction", "%$query%")
                ->orderBy("o.$fieldSearchFunction")
            ;
        } elseif (is_callable($fieldSearchFunction)) {
            $fieldSearchFunction($queryBuilder, $query);
        }

        // page & limit
        if (is_int($page) && $page > 0 &&  is_int($limit) && $limit > 0) {
            $queryBuilder = $queryBuilder
                ->setFirstResult(($page - 1) * $limit)
                ->setMaxResults($limit + 1)
            ;
        }

        // get results
        $result = $queryBuilder
            ->getQuery()
            ->getResult()
        ;

        if ($renderResult == null) {
            $getter = is_string($fieldSearchFunction) ? $this->getGetter($fieldSearchFunction) : '__toString';
            $renderResult = function ($entity, $query) use ($getter) {
                return [
                    'text' => $entity->$getter(),
                    'id' => $entity->getId(),
                ];
            };
        }

        // create response
        foreach ($result as $object) {
            $res['results'][] = $renderResult($object, $query);
        }

        // check if not more result
        if (count($result) > $limit) {
            $res['more'] = true;
            $res['results'] = array_slice($res['results'], 0, $limit);
        }

        $response = new JsonResponse($res);
        $response->setCallback($request->get('callback'));

        // send data into JSON
        return $response;
    }
968317
public function indexAction(Request $request)
    {
        /* init filters */
        $filter['q'] = $request->get('q');

        $em = $this->getDoctrine()->getManager();
        $qb = $em->getRepository('AmulenUserBundle:User')->createQueryBuilder('u');
        if ($filter['q']) {
            $qb->andWhere('(u.username LIKE :username OR u.email LIKE :username OR u.email LIKE :username OR u.firstname LIKE :username OR u.lastname LIKE :username)')->setParameter('username', '%' . $filter['q'] . '%');
        }

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

        return array(
            'paginator' => $paginator,
            'filter' => $filter,
        );
    }
1363698
public function listAction(Request $request)
    {
        $theme = $request->attributes->get(
            'synapse_theme',
            $this->container->get('synapse')
                ->enableDefaultTheme()
                ->getCurrentTheme()
        );

        $templateCollection = $this->container->get('synapse.template.loader')
            ->retrieveAll(array(
                'scope' => TemplateInterface::GLOBAL_SCOPE,
                'templateTypeId' => $theme->getTemplateTypes()->column('id')
            ))
        ;
        $templateMap = array();
        foreach ($templateCollection as $template) {
            $templateMap[$template->getTemplateType()->getName()][$template->getContentType()->getName()] = $template;
        }

        return $this->render('SynapseAdminBundle:Template:list.html.twig', array(
            'theme' => $theme,
            'content_types' => $this->container->get('synapse.content_type.loader')
                ->retrieveAll(),
            'templates' => $templateMap,
        ));
    }
1355244
public function show(Request $request)
    {
        $count = $request->query->get('count', \Bolt\Stack::MAX_ITEMS);
        $options = $request->query->get('options');

        if ($options === 'ck') {
            $template = '@bolt/components/stack/ck.twig';
        } elseif ($options === 'list') {
            $template = '@bolt/components/stack/list.twig';
        } else {
            $template = '@bolt/components/stack/panel.twig';
        }

        $context = [
            'count'     => $count,
            'filetypes' => $this->getOption('general/accept_file_types'),
            'namespace' => $this->app['upload.namespace'],
            'canUpload' => $this->isAllowed('files:uploads'),
        ];

        return $this->render($template, ['context' => $context]);
    }
1171250
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, SiteInterface::ENTITY_TYPE);
        $mapping = array(
            'name' => 'name'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository =  $this->get('open_orchestra_model.repository.site');

        $siteIds = null;
        if (false === $this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
            $siteIds = array();
            $availableSites = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getAvailableSites();
            foreach ($availableSites as $site) {
                $siteIds[] = $site->getSiteId();
            }
        }

        $collection = $repository->findForPaginateFilterBySiteIds($configuration, $siteIds);
        $recordsTotal = $repository->countFilterBySiteIds($siteIds);
        $recordsFiltered = $repository->countWithFilterAndSiteIds($configuration, $siteIds);
        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('site_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }