コード例 #1
0
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("simple_query_string_test");
     $docs = array(new Document(1, array('make' => 'Gibson', 'model' => 'Les Paul')), new Document(2, array('make' => 'Gibson', 'model' => 'SG Standard')), new Document(3, array('make' => 'Gibson', 'model' => 'SG Supreme')), new Document(4, array('make' => 'Gibson', 'model' => 'SG Faded')), new Document(5, array('make' => 'Fender', 'model' => 'Stratocaster')));
     $this->_index->getType("guitars")->addDocuments($docs);
     $this->_index->refresh();
 }
コード例 #2
0
ファイル: PostFilterTest.php プロジェクト: tkaven/Elastica
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("query");
     $docs = array(new Document("1", array("color" => "green", "make" => "ford")), new Document("2", array("color" => "blue", "make" => "volvo")), new Document("3", array("color" => "red", "make" => "ford")), new Document("4", array("color" => "green", "make" => "renault")));
     $this->_index->getType("test")->addDocuments($docs);
     $this->_index->refresh();
 }
コード例 #3
0
 protected function setUp()
 {
     parent::setUp();
     $this->_snapshot = new Snapshot($this->_getClient());
     $this->_index = $this->_createIndex();
     $this->_docs = array(new Document('1', array('city' => 'San Diego')), new Document('2', array('city' => 'San Luis Obispo')), new Document('3', array('city' => 'San Francisco')));
     $this->_index->getType('test')->addDocuments($this->_docs);
     $this->_index->refresh();
 }
コード例 #4
0
 protected function setUp()
 {
     parent::setUp();
     $this->_snapshot = new Snapshot($this->_getClient());
     $this->_index = $this->_createIndex("test_snapshot");
     $this->_docs = array(new Document("1", array("city" => "San Diego")), new Document("2", array("city" => "San Luis Obispo")), new Document("3", array("city" => "San Francisco")));
     $this->_index->getType("test")->addDocuments($this->_docs);
     $this->_index->refresh();
 }
コード例 #5
0
ファイル: HealthTest.php プロジェクト: bungkoko/Elastica
 protected function setUp()
 {
     parent::setUp();
     $data = array('cluster_name' => 'test_cluster', 'status' => 'green', 'timed_out' => false, 'number_of_nodes' => 10, 'number_of_data_nodes' => 8, 'active_primary_shards' => 3, 'active_shards' => 4, 'relocating_shards' => 2, 'initializing_shards' => 7, 'unassigned_shards' => 5, 'indices' => array('index_one' => array(), 'index_two' => array()));
     $health = $this->getMockBuilder('Elastica\\Cluster\\Health')->setConstructorArgs(array($this->_getClient()))->setMethods(array('_retrieveHealthData'))->getMock();
     $health->expects($this->any())->method('_retrieveHealthData')->will($this->returnValue($data));
     // need to explicitly refresh because the mocking won't refresh the data in the constructor
     $health->refresh();
     $this->_health = $health;
 }
コード例 #6
0
 protected function setUp()
 {
     $this->markTestSkipped('Snapshot tests currently skipped because not working on Travis');
     parent::setUp();
     $this->_snapshot = new Snapshot($this->_getClient());
     $this->_index = $this->_createIndex();
     $this->_docs = array(new Document('1', array('city' => 'San Diego')), new Document('2', array('city' => 'San Luis Obispo')), new Document('3', array('city' => 'San Francisco')));
     $this->_index->getType('test')->addDocuments($this->_docs);
     $this->_index->refresh();
 }
コード例 #7
0
 protected function setUp()
 {
     parent::setUp();
     $this->index = $this->_createIndex('test_functionscore');
     $this->type = $this->index->getType('test');
     $this->type->setMapping(array('name' => array('type' => 'string', 'index' => 'not_analyzed'), 'location' => array('type' => 'geo_point'), 'price' => array('type' => 'float')));
     $this->type->addDocument(new Document(1, array('name' => "Mr. Frostie's", 'location' => array('lat' => 32.799605, 'lon' => -117.243027), 'price' => 4.5)));
     $this->type->addDocument(new Document(2, array('name' => "Miller's Field", 'location' => array('lat' => 32.795964, 'lon' => -117.255028), 'price' => 9.5)));
     $this->index->refresh();
 }
コード例 #8
0
 protected function setUp()
 {
     parent::setUp();
     $this->index = $this->_createIndex('test_boostingquery');
     $this->type = $this->index->getType('test');
     $this->type->setMapping(array('name' => array('type' => 'string', 'index' => 'analyzed'), 'price' => array('type' => 'float')));
     $this->sampleData = array(array("name" => "Vital Lama", "price" => 5.2), array("name" => "Vital Match", "price" => 2.1), array("name" => "Mercury Vital", "price" => 7.5), array("name" => "Fist Mercury", "price" => 3.8), array("name" => "Lama Vital 2nd", "price" => 3.2));
     foreach ($this->sampleData as $key => $value) {
         $this->type->addDocument(new Document($key, $value));
     }
     $this->index->refresh();
 }
コード例 #9
0
ファイル: IndicesTest.php プロジェクト: tkaven/Elastica
 protected function setUp()
 {
     parent::setUp();
     $this->_index1 = $this->_createIndex('indices_filter_1');
     $this->_index2 = $this->_createIndex('indices_filter_2');
     $this->_index1->addAlias("indices_filter");
     $this->_index2->addAlias("indices_filter");
     $docs = array(new Document("1", array("color" => "blue")), new Document("2", array("color" => "green")), new Document("3", array("color" => "blue")), new Document("4", array("color" => "yellow")));
     $this->_index1->getType("test")->addDocuments($docs);
     $this->_index2->getType("test")->addDocuments($docs);
     $this->_index1->refresh();
     $this->_index2->refresh();
 }
コード例 #10
0
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex('test_suggest_phrase');
     $docs = array();
     $docs[] = new Document(1, array('text' => 'Github is pretty cool'));
     $docs[] = new Document(2, array('text' => 'Elasticsearch is bonsai cool'));
     $docs[] = new Document(3, array('text' => 'This is a test phrase'));
     $docs[] = new Document(4, array('text' => 'Another sentence for testing'));
     $docs[] = new Document(5, array('text' => 'Some more words here'));
     $type = $this->_index->getType(self::TEST_TYPE);
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
コード例 #11
0
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex('test_suggest');
     $docs = array();
     $docs[] = new Document(1, array('id' => 1, 'text' => 'GitHub'));
     $docs[] = new Document(2, array('id' => 1, 'text' => 'Elastic'));
     $docs[] = new Document(3, array('id' => 1, 'text' => 'Search'));
     $docs[] = new Document(4, array('id' => 1, 'text' => 'Food'));
     $docs[] = new Document(5, array('id' => 1, 'text' => 'Flood'));
     $docs[] = new Document(6, array('id' => 1, 'text' => 'Folks'));
     $type = $this->_index->getType(self::TEST_TYPE);
     $type->addDocuments($docs);
     $this->_index->refresh();
 }
コード例 #12
0
ファイル: IdsTest.php プロジェクト: MediaWiki-stable/1.26.1
 protected function setUp()
 {
     parent::setUp();
     $index = $this->_createIndex();
     $type1 = $index->getType('helloworld1');
     $type2 = $index->getType('helloworld2');
     $doc = new Document(1, array('name' => 'hello world'));
     $type1->addDocument($doc);
     $doc = new Document(2, array('name' => 'nicolas ruflin'));
     $type1->addDocument($doc);
     $doc = new Document(3, array('name' => 'ruflin'));
     $type1->addDocument($doc);
     $doc = new Document(4, array('name' => 'hello world again'));
     $type2->addDocument($doc);
     $index->refresh();
     $this->_type = $type1;
     $this->_index = $index;
 }
コード例 #13
0
 public function setUp()
 {
     parent::setUp();
     $shardData = array('status' => 'red', 'primary_active' => true, 'active_shards' => 1, 'relocating_shards' => 0, 'initializing_shards' => 0, 'unassigned_shards' => 1);
     $this->_shard = new HealthShard(2, $shardData);
 }
コード例 #14
0
 public function setUp()
 {
     parent::setUp();
     $data = array('status' => 'yellow', 'number_of_shards' => 1, 'number_of_replicas' => 2, 'active_primary_shards' => 3, 'active_shards' => 4, 'relocating_shards' => 5, 'initializing_shards' => 6, 'unassigned_shards' => 7, 'shards' => array('0' => array('status' => 'yellow', 'primary_active' => false, 'active_shards' => 0, 'relocating_shards' => 1, 'initializing_shards' => 0, 'unassigned_shards' => 1), '1' => array('status' => 'yellow', 'primary_active' => true, 'active_shards' => 1, 'relocating_shards' => 0, 'initializing_shards' => 0, 'unassigned_shards' => 1), '2' => array('status' => 'green', 'primary_active' => true, 'active_shards' => 1, 'relocating_shards' => 0, 'initializing_shards' => 0, 'unassigned_shards' => 0)));
     $this->_index = new HealthIndex('test', $data);
 }
コード例 #15
0
 protected function setUp()
 {
     parent::setUp();
     $this->_index = $this->_createIndex("rescore_test");
     $this->_index->refresh();
 }
コード例 #16
0
 protected function setUp()
 {
     parent::setUp();
     $this->es20('Benchmarks currently skipped with es2.0');
 }
コード例 #17
0
ファイル: ImageTest.php プロジェクト: JanJakes/Elastica
 protected function setUp()
 {
     parent::setUp();
     $this->_testFileContent = base64_encode(file_get_contents(BASE_PATH . '/data/test.jpg'));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->markTestIncomplete('Benchmarks currently skipped with es2.0. Has to be reworked');
 }