Search.

@param Request $request

@return Response
420820
public function search(Request $request)
    {
        $input = $request->all();

        $result = $this->repository->search($input);

        return view('cms::modules.files.index')
            ->with('files', $result[0]->get())
            ->with('pagination', $result[2])
            ->with('term', $result[1]);
    }
604814
public function match(Request $request)
    {
        foreach ($this->matchers as $matcher) {
            $matcherInstance = app($matcher);
            if ($matcherInstance->matches($request->getPathInfo())) {
                return $matcherInstance->render($request);
            }
        }

        return $this->handlePageNotFound();
    }
1268296
public function index(Request $request)
    {
        $limit = 20;
        $prev = null;
        $user = $request->user();

        $this->validate($request, [
            'since'     => 'iso8601',
            'until'     => 'iso8601',
            'cursor'    => 'uuid',
            'tag_id'    => 'uuid',
            'source_id' => 'uuid',
            ]);

        $dids = $user->dids()
            ->fullTextSearchFilter($request->q, $user->id)
            ->tagFilter($request->tag_id)
            ->sourceFilter($request->source_id)
            ->cursorFilter($request->cursor)
            ->dateFilter($request->since, $request->until)
            ->with(['tags', 'source'])
            ->orderBy(DB::raw('uuid_v1_timestamp(id)'), 'DESC')
            ->limit($limit)->get();

        // if the cursor is being passed in then we need to obtain the previous id.
        if(!empty($request->cursor)){
            $dids_prev = $user->dids()
                ->fullTextSearchFilter($request->q, $user->id)
                ->tagFilter($request->tag_id)
                ->sourceFilter($request->source_id)
                ->prevFilter($request->cursor)
                ->dateFilter($request->since, $request->until)
                ->orderBy(DB::raw('uuid_v1_timestamp(id)'), 'ASC')
                ->limit($limit)->get();

            if($dids_prev->count() == $limit) $prev = $dids_prev->last()->id;
        }

        $results = fractal()
            ->collection($dids, new DidTransformer())
            ->withCursor(new Cursor($request->cursor, $prev, $dids, $limit));

        return response()->json($results);
    }
1074729
protected function getFilters(Request $request)
    {
        $type = $this->getFilterType($request);

        if (!$type) {
            return $request->query->get('search')['value'];
        }

        $filter = new $type();

        $param = $filter->getBlockPrefix();

        return $request->query->get($param);
    }
1341171
public function resolve(Request $request) : Response {
        if($request->expectsJson()) {
            return $this->json();
        }

        return $this->redirect();
    }
754810
public function submitAction(Request $request)
    {
        $template = 'EnhavoSearchBundle:Admin:Search/result.html.twig';

        $term = $request->get('q', '');

        $filter = new Filter();
        $filter->setTerm($term);

        $results = $this->searchEngine->searchPaginated($filter);
        $results = $this->resultConverter->convert($results, $term);

        return $this->render($template, [
            'results' => $results,
            'term' => $term
        ]);
    }
32412
public function find(Request $request)
    {
        $app = $this->app;

        /** @var SingularStore $store */
        $store = $this->getStore();

        if (method_exists($this, 'beforeFind')) {
            $response = $this->beforeFind($request);

            if ($response instanceof Response) {
                return $response;
            }
        }

        $filters = $request->get('filter', $this->getBaseFilters());
        $paging = $request->get('paging', $this->paging);
        $sort = $request->get('sort', $this->sort);

        $data = $store->findBy($filters, $paging, $sort);
        $data['success'] = true;

        if (method_exists($this, 'afterFind')) {
            $response = $this->afterFind($request, $data);

            if ($data instanceof Response) {
                return $response;
            }
        }

        return $app->json($data);
    }
807739
public function process(Request $request)
    {
        $this->validate($request->all(), $this->rules);

        if ($request->has('q')) {
            $this->searchQuery = $request->get('q');
        }
        if ($request->has('sort')) {
            foreach (explode(',', $request->get('sort')) as $sort) {
                $this->processOrderByParams($sort);
            }
        }
        $this->processPageParams($request);

        foreach ($this->parsers as $parser) {
            $parser->parse($request);
        }

        return $this;
    }
663418
public function searchAction(Request $request)
    {
        $subdefTransformer = new SubdefTransformer($this->app['acl'], $this->getAuthenticatedUser(), new PermalinkTransformer());
        $technicalDataTransformer = new TechnicalDataTransformer();
        $recordTransformer = new RecordTransformer($subdefTransformer, $technicalDataTransformer);
        $storyTransformer = new StoryTransformer($subdefTransformer, $recordTransformer);
        $compositeTransformer = new V1SearchCompositeResultTransformer($recordTransformer, $storyTransformer);
        $searchTransformer = new V1SearchResultTransformer($compositeTransformer);

        $transformerResolver = new SearchResultTransformerResolver([
            '' => $searchTransformer,
            'results' => $compositeTransformer,
            'results.stories' => $storyTransformer,
            'results.stories.thumbnail' => $subdefTransformer,
            'results.stories.metadatas' => new CallbackTransformer(),
            'results.stories.caption' => new CallbackTransformer(),
            'results.stories.records' => $recordTransformer,
            'results.stories.records.thumbnail' => $subdefTransformer,
            'results.stories.records.technical_informations' => $technicalDataTransformer,
            'results.stories.records.subdefs' => $subdefTransformer,
            'results.stories.records.metadata' => new CallbackTransformer(),
            'results.stories.records.status' => new CallbackTransformer(),
            'results.stories.records.caption' => new CallbackTransformer(),
            'results.records' => $recordTransformer,
            'results.records.thumbnail' => $subdefTransformer,
            'results.records.technical_informations' => $technicalDataTransformer,
            'results.records.subdefs' => $subdefTransformer,
            'results.records.metadata' => new CallbackTransformer(),
            'results.records.status' => new CallbackTransformer(),
            'results.records.caption' => new CallbackTransformer(),
        ]);

        $includeResolver = new IncludeResolver($transformerResolver);

        $fractal = new \League\Fractal\Manager();
        $fractal->setSerializer(new TraceableArraySerializer($this->app['dispatcher']));
        $fractal->parseIncludes($this->resolveSearchIncludes($request));

        $result = $this->doSearch($request);
        $searchView = $this->buildSearchView(
            $result,
            $includeResolver->resolve($fractal),
            $this->resolveSubdefUrlTTL($request)
        );

        $ret = $fractal->createData(new Item($searchView, $searchTransformer))->toArray();

        return Result::create($request, $ret)->createResponse();
    }
882230
public function httpPost(Request $request) : Response
    {
        $response = new Response();
        $response->headers->set('Content-Type', 'application/json');

        $response->setContent(
            $this->sdkEndpoint->index(
                $request->getContent()
            )
        );

        return $response;
    }
352123
public function handle(Request $request)
	{
		$response = $this->next($request);

		if ($content = $response->original)
		{
			$content = $this->traverse($request, $content);

			$response->setContent($content);
		}

		return $response;
	}
833663
public function search(Request $request): Response
    {
        $configResolver = $this->getConfigResolver();
        $queryType = $this->getQueryTypeRegistry()->getQueryType('NetgenSite:Search');

        $searchText = trim($request->query->get('searchText', ''));

        if (empty($searchText)) {
            return $this->render(
                $configResolver->getParameter('template.search', 'ngsite'),
                [
                    'search_text' => '',
                    'pager' => null,
                ]
            );
        }

        $pager = new Pagerfanta(
            new FindAdapter(
                $queryType->getQuery(['search_text' => $searchText]),
                $this->getSite()->getFindService()
            )
        );

        $pager->setNormalizeOutOfRangePages(true);
        $pager->setMaxPerPage((int) $configResolver->getParameter('search.default_limit', 'ngsite'));

        $currentPage = $request->query->getInt('page', 1);
        $pager->setCurrentPage($currentPage > 0 ? $currentPage : 1);

        return $this->render(
            $configResolver->getParameter('template.search', 'ngsite'),
            [
                'search_text' => $searchText,
                'pager' => $pager,
            ]
        );
    }
1005204
public function index(Request $request)
    {
        $this->validate($request, ['thread_id' => ['required']]);

        $posts = $this->model()->where('thread_id', $request->input('thread_id'))->get();

        return $this->response($posts);
    }
287972
public function cgetAction(Request $request)
    {
        $locale = $this->getRequestParameter($request, 'locale', true);

        $restHelper = $this->get('sulu_core.list_rest_helper');

        /** @var Manager $manager */
        $manager = $this->get('es.manager.default');
        $repository = $manager->getRepository($this->get('sulu_article.view_document.factory')->getClass('article'));
        $search = $repository->createSearch();

        $limit = (int) $restHelper->getLimit();
        $page = (int) $restHelper->getPage();

        if (null !== $locale) {
            $search->addQuery(new TermQuery('locale', $locale));
        }

        if (count($ids = array_filter(explode(',', $request->get('ids', ''))))) {
            $search->addQuery(new IdsQuery($this->getViewDocumentIds($ids, $locale)));
            $limit = count($ids);
        }

        if (!empty($searchPattern = $restHelper->getSearchPattern())
            && 0 < count($searchFields = $restHelper->getSearchFields())
        ) {
            $boolQuery = new BoolQuery();
            foreach ($searchFields as $searchField) {
                $boolQuery->add(new MatchPhrasePrefixQuery($searchField, $searchPattern), BoolQuery::SHOULD);
            }
            $search->addQuery($boolQuery);
        }

        if (null !== ($type = $request->get('type'))) {
            $search->addQuery(new TermQuery('type', $type));
        }

        if ($contactId = $request->get('contactId')) {
            $boolQuery = new BoolQuery();
            $boolQuery->add(new MatchQuery('changer_contact_id', $contactId), BoolQuery::SHOULD);
            $boolQuery->add(new MatchQuery('creator_contact_id', $contactId), BoolQuery::SHOULD);
            $boolQuery->add(new MatchQuery('author_id', $contactId), BoolQuery::SHOULD);
            $search->addQuery($boolQuery);
        }

        if ($categoryId = $request->get('categoryId')) {
            $search->addQuery(new TermQuery('excerpt.categories.id', $categoryId), BoolQuery::MUST);
        }

        if ($tagId = $request->get('tagId')) {
            $search->addQuery(new TermQuery('excerpt.tags.id', $tagId), BoolQuery::MUST);
        }

        if ($pageId = $request->get('pageId')) {
            $search->addQuery(new TermQuery('parent_page_uuid', $pageId), BoolQuery::MUST);
        }

        if ($workflowStage = $request->get('workflowStage')) {
            $search->addQuery(new TermQuery('published_state', 'published' === $workflowStage), BoolQuery::MUST);
        }

        if ($this->getBooleanRequestParameter($request, 'exclude-shadows', false, false)) {
            $search->addQuery(new TermQuery('localization_state.state', 'shadow'), BoolQuery::MUST_NOT);
        }

        if ($this->getBooleanRequestParameter($request, 'exclude-ghosts', false, false)) {
            $search->addQuery(new TermQuery('localization_state.state', 'ghost'), BoolQuery::MUST_NOT);
        }

        $authoredFrom = $request->get('authoredFrom');
        $authoredTo = $request->get('authoredTo');
        if ($authoredFrom || $authoredTo) {
            $search->addQuery($this->getRangeQuery('authored', $authoredFrom, $authoredTo), BoolQuery::MUST);
        }

        if (null === $search->getQueries()) {
            $search->addQuery(new MatchAllQuery());
        }

        if (null !== $restHelper->getSortColumn() &&
            $sortField = $this->getSortFieldName($restHelper->getSortColumn())
        ) {
            $search->addSort(
                new FieldSort($sortField, $restHelper->getSortOrder())
            );
        }

        $fieldDescriptors = $this->getFieldDescriptors();

        if ($limit) {
            $search->setSize($limit);
            $search->setFrom(($page - 1) * $limit);

            $fields = array_merge(
                $restHelper->getFields() ?: [],
                ['id', 'localizationState', 'publishedState', 'published']
            );
            $fieldDescriptors = array_filter(
                $fieldDescriptors,
                function (FieldDescriptorInterface $fieldDescriptor) use ($fields) {
                    return in_array($fieldDescriptor->getName(), $fields);
                }
            );
        } else {
            $search->setSize(1000);
            $search->setScroll('1m');
        }

        $searchResult = $repository->findRaw($search);
        $result = [];
        foreach ($searchResult as $document) {
            $documentData = $this->normalize($document['_source'], $fieldDescriptors);
            if (false !== ($index = array_search($documentData['id'], $ids))) {
                $result[$index] = $documentData;
            } else {
                $result[] = $documentData;
            }
        }

        if (count($ids)) {
            ksort($result);
            $result = array_values($result);
        }

        $count = $searchResult->count();

        return $this->handleView(
            $this->view(
                new ListRepresentation(
                    $result,
                    'articles',
                    'get_articles',
                    $request->query->all(),
                    $page,
                    $limit,
                    $count
                )
            )
        );
    }
556327
protected function getFiltersFromRequest(Request $request)
    {
        return $this->extractValues($this->getValuesFromRequest($request), $this->getFilterPrefix());
    }
671136
public function search(Request $request)
    {
        $features = $this->service->search($request->search, null);
        return view('admin.features.index')->with('features', $features);
    }
874128
protected function doRequest(Request $request)
    {

        $this->client->send($request, $response = new Response());

        return $response;
    }