Пример #1
0
 /**
  * @test
  */
 public function fetchMultipleDocumentsWorks()
 {
     $data = json_encode(array('name' => 'Foo'));
     $this->connector->put('/flow3_test/abc', array(), $data);
     $data = json_encode(array('name' => 'Bar'));
     $this->connector->put('/flow3_test/def', array(), $data);
     $data = json_encode(array('name' => 'Baz'));
     $this->connector->put('/flow3_test/ghi', array(), $data);
     $data = json_encode(array('keys' => array('abc', 'ghi')));
     $response = $this->connector->post('/flow3_test/_all_docs', array('include_docs' => TRUE), $data);
     $this->assertObjectHasAttribute('rows', $response);
     $this->assertEquals(2, count($response->rows));
     $row = $response->rows[1];
     $this->assertEquals('Baz', $row->doc->name);
     $this->assertEquals(3, $response->total_rows);
 }
Пример #2
0
 /**
  * Query a lucene index
  *
  * @param string $underscoredIndexName The design document name of the index
  * @param string $indexType Type of the index to query
  * @param array $queryOptions
  * @return mixed
  * @author Felix Oertel <*****@*****.**>
  */
 public function queryIndex($underscoredIndexName, $indexType, array $queryOptions = NULL)
 {
     $requestOptions = $this->extractRequestOptions($queryOptions);
     $path = '/_fti/local/' . urlencode($this->getDatabaseName()) . '/_design/' . urlencode($underscoredIndexName) . '/search';
     return $this->connector->get($path, $queryOptions, NULL, $requestOptions);
 }