/**
  * @param string $dataset
  * @param string $query
  * @param string $sort
  * @param int $rows
  * @param int $start
  *
  * @return Response
  */
 public function searchAction($dataset, $query, $sort, $rows, $start)
 {
     $search = new Search($dataset);
     $search->setFilter($query)->setStart($start)->setSort($sort)->setRows($rows);
     $results = $this->search($search);
     return new Response(json_encode($results));
 }
Exemplo n.º 2
0
 private function createQueryColumnFilterSearch($column, $value, $delimiter = ':')
 {
     $filter = sprintf('%s%s%s', $column, $delimiter, $value);
     $dataset = uniqid();
     $search = new Search($dataset);
     $search->setFilter($filter);
     $this->assertEquals($filter, $search->getFilter());
     $this->assertEquals($column, $search->getFilterColumn());
     $this->assertEquals($value, $search->getFilterValue());
 }
 /**
  * Look locally (parsers)
  *
  * @param Search $search
  *
  * @return array|false
  */
 private function searchDistant(Search $search)
 {
     $data = array();
     $result = $this->client->get('search', $search->getParameters());
     if ($result) {
         $result = json_decode($result, true);
         foreach ($result['records'] as $record) {
             $data[] = $record['fields'];
         }
     }
     return $data;
 }