コード例 #1
0
 /**
  * Tests setters & getters.
  */
 public function testSetterGetter()
 {
     $this->specify('index can be set and get', function () {
         $this->search->setIndex('index');
         verify($this->search->getIndex())->equals('index');
     });
     $this->specify('type can be set and get', function () {
         $this->search->setType('doc');
         verify($this->search->getType())->equals('doc');
     });
     $this->specify('query can be set and get', function () {
         $this->search->setQuery($this->query);
         verify($this->search->getQuery())->isInstanceOf('\\Nord\\Lumen\\Elasticsearch\\Search\\Query\\Compound\\BoolQuery');
     });
     $this->specify('page can be set and get', function () {
         $this->search->setPage(1);
         verify($this->search->getPage())->equals(1);
     });
     $this->specify('size can be set and get', function () {
         $this->search->setSize(100);
         verify($this->search->getSize())->equals(100);
     });
     $this->specify('sort can be set and get', function () {
         $this->search->setSort($this->sort);
         verify($this->search->getSort())->isInstanceOf('\\Nord\\Lumen\\Elasticsearch\\Search\\Sort');
     });
     $this->specify('aggregation can be added and collection retrieved', function () {
         $this->search->addAggregation($this->aggregation);
         $collection = $this->search->getAggregations();
         verify($collection)->isInstanceOf('\\Nord\\Lumen\\Elasticsearch\\Search\\Aggregation\\AggregationCollection');
     });
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function execute(Search $search)
 {
     return $this->search(['index' => $search->getIndex(), 'type' => $search->getType(), 'body' => $search->buildBody()]);
 }