Search Records
@param Request $request
@return Response
324991
public function searchAction(Request $request)
    {
        $fractal = new Manager();
        $fractal->setSerializer(new ArraySerializer());
        $fractal->parseIncludes([]);

        $searchView = new SearchResultView($this->doSearch($request));
        $ret = $fractal->createData(new Item($searchView, new V2SearchTransformer()))->toArray();

        return Result::create($request, $ret)->createResponse();
    }
287310
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, KeywordInterface::ENTITY_TYPE);
        $mapping = array(
            'label' => 'label'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository = $this->get('open_orchestra_model.repository.keyword');
        $collection = $repository->findForPaginate($configuration);
        $recordsTotal = $repository->count();
        $recordsFiltered = $repository->countWithFilter($configuration);
        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('keyword_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }
1291066
public function search($query)
    {
        try {
            $request = $this->client->createRequest($query);
            $response = $this->executeRequest($request);
            $this->hasSearched = true;
            $this->responseCache = $response;
        } catch (HttpException $e) {
            $this->handleErrorResponses($e);
        }
        return $response;
    }
90501
protected function getRequestParameters(Request $request)
    {
        // $page current page of the grid
        $page = (int) $request->query->get('page', 0);
        
        // $orderBy column name to sort datagrid records
        $orderBy = $request->query->get('sidx', false);
        
        // ASC | DESC $sort
        $sort = strtoupper($request->query->get('sord', 'asc'));
        
        // $records  number of records to display
        $records = (int) $request->query->get('rows', 0);
        
        // $search is search in the query
        $search = ($request->query->get('_search', false) === 'true');
 
        // $filters Filters from the search query
        $filters = (array) json_decode($request->query->get('filters', '{}'));
        
        
        $parameters = array(
            'page'            => $page,
            'orderBy'         => $orderBy,
            'sort'            => $sort,
            'records'         => $records,
            'search'          => $search,
            'filters'         => $filters,
        );
        
        return $parameters;
    }
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);
    }
124353
protected function searchBooks( $request ) {

		if ( ! empty( $request['next'] ) ) {
			$this->lastKnownBookId = $request['next'];
		}

		$start_time = time();
		$searched_books = 0;
		$found_books = 0;
		$results = [];
		while ( $found_books < $request['per_page'] ) {
			$book_ids = $this->searchBookIds( $request );
			foreach ( $book_ids as $id ) {
				$node = $this->renderBook( $id, $request['search'] );
				if ( ! empty( $node ) ) {
					$response = rest_ensure_response( $node );
					$response->add_links( $this->linkCollector );
					$results[] = $this->prepare_response_for_collection( $response );
					$this->linkCollector = []; // re-initialize
					++$found_books;
				}
				++$searched_books;
				$this->lastKnownBookId = $id;
				if ( time() - $start_time > $this->maxSearchTime ) {
					break 2;
				}
			}
			if ( $searched_books >= $this->totalBooks ) {
				break;
			}
		}

		if ( ! $searched_books ) {
			$this->lastKnownBookId = 0;
		}

		return $results;
	}
85769
public function searchFillerAction(Request $request)
    {
        /* @var $chain ChainFiller */
        $chain = $this->get('anime_db.plugin.filler');
        $response = $this->getResponseFromChain($chain);

        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        $entity = new SearchFiller($chain);
        /* @var $form Form */
        $form = $this->createForm(new SearchFillerForm(), $entity)->handleRequest($request);
        if ($form->isValid()) {
            return $this->redirect($entity->getFiller()->getLinkForFill($entity->getUrl()));
        }

        return $this->render('AnimeDbCatalogBundle:Fill:search_filler.html.twig', [
            'form' => $form->createView(),
        ], $response);
    }
657744
public function index(Request $request)
    {
        $query = Tag::query();

        if ($request->has('filter.containing')) {
            $query->containing($request['filter']['containing']);
        }

        if ($request->has('filter.type')) {
            $query->where('type', $request['filter']['type']);
        }

        if ($request->has('limit')) {
            $query->limit($request['limit']);
        }

        return $query->get()->map(function (Tag $tag) {
            return $tag->name;
        });
    }
797988
public function searchTagsAction(Request $request)
    {
        $q = $request->get('q');
        $response = [];
        $query = $this->admin->getModelManager()->createQuery($this->admin->getClass(), 't');
        $query->select('t.id, t.path AS text');
        $query->andWhere('t.path LIKE :q');
        $query->orderBy('text', 'ASC');
        $query->setParameter(':q', '%'.$q.'%');
        $response = $query->execute([], Query::HYDRATE_ARRAY);

        return $this->renderJson($response);
    }
1162189
public function search(HTTPRequest $request)
    {
        // Detect Ajax:
        
        if (!$request->isAjax()) {
            return;
        }
        
        // Initialise:
        
        $data = ['results' => []];
        
        // Create Data List:
        
        $list = $this->getList();
        
        // Filter Data List:
        
        if ($term = $request->getVar('term')) {
            $list = $list->filterAny($this->getSearchFilters($term))->exclude($this->getExclude());
        }
        
        // Sort Data List:
        
        if ($sort = $this->getSortBy()) {
            $list = $list->sort($sort);
        }
        
        // Limit Data List:
        
        if ($limit = $this->getLimit()) {
            $list = $list->limit($limit);
        }
        
        // Define Results:
        
        foreach ($list as $record) {
            $data['results'][] = $this->getResultData($record);
        }
        
        // Answer JSON Response:
        
        return $this->respond($data);
    }
137539
public function index(Request $request)
	{
		$request = $this->getRequest();

		return $this->response()
			->collection($this->getModel()->search($request->input('q', ''))->limit(100)->get())
			->view($this->getView('index'), [
				'entities' => $this->getModel()->getRepository()->all()->get()
			]);
	}
1328229
public function send(Request $request)
    {
        $response     = new SearchResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $json         = $httpResponse->json();
        $result       = $json['response'];

        $response->docs     = $result['docs'];
        $response->numFound = $result['numFound'];
        $response->maxScore = $result['maxScore'];
        $response->docs     = array_map([$this, 'docToArray'], $result['docs']);

        return $response;
    }
941034
public function playback(Request $request)
    {
        foreach ($this->storage as $recording) {
            $storedRequest = Request::fromArray($recording['request']);
            if ($storedRequest->matches($request, $this->getRequestMatchers())) {
                return Response::fromArray($recording['response']);
            }
        }

        return null;
    }
1096981
public function index(Request $request)
    {
        $keyword = $request->get('search');
        $perPage = 25;

        if (!empty($keyword)) {
            $settings = Setting::where('key', 'LIKE', "%$keyword%")
                ->orWhere('value', 'LIKE', "%$keyword%")
                ->orderBy('key')->paginate($perPage);
        } else {
            $settings = Setting::orderBy('key')->paginate($perPage);
        }

        return view('admin.settings.index', compact('settings'));
    }
770582
public function send(Request $request)
    {
        $response = new SearchResponse();
        $rpbReq   = $this->createRpbMessage($request);
        $rpbResp  = $this->client->send($rpbReq, RiakMessageCodes::SEARCH_QUERY_REQ, RiakMessageCodes::SEARCH_QUERY_RESP);

        if ( ! $rpbResp instanceof RpbSearchQueryResp) {
            return $response;
        }

        $response->numFound = $rpbResp->num_found;
        $response->maxScore = $rpbResp->max_score;

        if ( ! $rpbResp->hasDocs()) {
            return $response;
        }

        $response->docs = array_map([$this, 'docToArray'], $rpbResp->docs);

        return $response;
    }
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;
    }
494840
public static function getIndexRecords($request, $parameters)
    {
        $instance = new static;

        if(method_exists($instance, 'addToGetIndexRecords'))
            $query = $instance->addToGetIndexRecords($request, $parameters);
        else
            if(method_exists($instance, 'scopeBuilder'))
                $query = $instance->builder();
            else
                $query = $instance->query();

        $query = Miscellaneous::getQueryWhere($request, $query, $parameters);

        if(isset($parameters['count']) &&  $parameters['count'])
        {
            // if we need count results
            if(method_exists($instance, 'customCountIndexRecords'))
                return $instance->customCountIndexRecords($query, $parameters);
            else
                return $query->count();
        }
        else
        {
            // if we need limit and order results
            if(isset($parameters['length']))
                $query->take($parameters['length']);

            if(isset($parameters['start']))
                $query->skip($parameters['start']);

            if(isset($parameters['order']) && is_array($parameters['order']))
                $query->orderBy($parameters['order']['column'], isset($parameters['order']['dir'])? $parameters['order']['dir'] : 'asc');


            if(method_exists($instance, 'getCustomReturnIndexRecords'))
            {
                // if we need a custom get()
                return $instance->getCustomReturnIndexRecords($query, $parameters);
            }
            else
            {
                // if has diplayColumns variable
                if(isset($parameters['displayColumns']) && is_array($parameters['displayColumns']) && count($parameters['displayColumns']) > 0)
                    return $query->get($parameters['displayColumns']);
                else
                    return $query->get();
            }
        }
    }