protected function getIndex()
 {
     $connection = new Search_Elastic_Connection('http://localhost:9200');
     $status = $connection->getStatus();
     if (!$status->ok) {
         $this->markTestSkipped('ElasticSearch needs to be available on localhost:9200 for the test to run.');
     }
     return new Search_Elastic_Index($connection, 'test_index');
 }
Exemple #2
0
 function testObtainStatus()
 {
     $connection = new Search_Elastic_Connection('http://localhost:9200');
     $status = $connection->getStatus();
     if (!$status->ok) {
         $this->markTestSkipped('ElasticSearch needs to be available on localhost:9200 for the test to run.');
     }
     $this->assertEquals(200, $status->status);
 }
Exemple #3
0
 function setUp()
 {
     $connection = new Search_Elastic_Connection('http://localhost:9200');
     $status = $connection->getStatus();
     if (!$status->ok) {
         $this->markTestSkipped('Elasticsearch needs to be available on localhost:9200 for the test to run.');
     }
     $this->connection = $connection;
 }
 function setUp()
 {
     $connection = new Search_Elastic_Connection('http://localhost:9200');
     $connection->startBulk(100);
     $status = $connection->getStatus();
     if (!$status->ok) {
         $this->markTestSkipped('ElasticSearch needs to be available on localhost:9200 for the test to run.');
     }
     $this->index = new Search_Elastic_Index($connection, 'test_index');
     $this->index->destroy();
 }
Exemple #5
0
 function setUp()
 {
     $connection = new Search_Elastic_Connection('http://localhost:9200');
     $status = $connection->getStatus();
     if (!$status->ok) {
         $this->markTestSkipped('Elasticsearch needs to be available on localhost:9200 for the test to run.');
     }
     if (version_compare($status->version->number, '1.1.0') < 0) {
         $this->markTestSkipped('Elasticsearch 1.1+ required');
     }
     $this->index = new Search_Elastic_Index($connection, 'test_index');
     $this->index->destroy();
     $factory = $this->index->getTypeFactory();
     $this->index->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('HomePage'), 'contents' => $factory->plaintext('Hello World')));
 }
 function setUp()
 {
     $connection = new Search_Elastic_Connection('http://localhost:9200');
     $status = $connection->getStatus();
     if (!$status->ok) {
         $this->markTestSkipped('ElasticSearch needs to be available on localhost:9200 for the test to run.');
     }
     $this->indexA = new Search_Elastic_Index($connection, 'test_index_a');
     $this->indexA->destroy();
     $factory = $this->indexA->getTypeFactory();
     $this->indexA->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('PageA'), 'contents' => $factory->plaintext('Hello World A'), 'url' => $factory->identifier('PageA')));
     $this->indexB = new Search_Elastic_Index($connection, 'test_index_b_foo');
     $this->indexB->destroy();
     $factory = $this->indexB->getTypeFactory();
     $this->indexB->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('PageB'), 'contents' => $factory->plaintext('Hello World B'), 'url' => $factory->identifier('PageB')));
     $this->indexC = new Search_Elastic_Index($connection, 'test_index_c');
     $this->indexC->destroy();
     $factory = $this->indexC->getTypeFactory();
     $this->indexC->addDocument(array('object_type' => $factory->identifier('wiki page'), 'object_id' => $factory->identifier('PageB'), 'contents' => $factory->plaintext('Hello World C'), 'url' => $factory->identifier('/PageC')));
     $connection->refresh('*');
     $connection->assignAlias('test_index_b', 'test_index_b_foo');
 }