Permalink
Browse files

Filled array of new Elastica_Documents in a loop

  • Loading branch information...
1 parent 5439fe7 commit 15e158906ecff3b9790a0069c39df290734188c8 @comulinux comulinux committed Apr 24, 2012
Showing with 4 additions and 12 deletions.
  1. +4 −12 test/lib/Elastica/SearchTest.php
View
16 test/lib/Elastica/SearchTest.php
@@ -236,25 +236,17 @@ public function testLimitDefaultSearch()
public function testArrayConfigSearch(){
- ini_set('display_errors',1);
$client = new Elastica_Client();
$search = new Elastica_Search($client);
$index = $client->getIndex('zero');
$index->create(array('index' => array('number_of_shards' => 1, 'number_of_replicas' => 0)), true);
$docs = array();
- $docs[] = new Elastica_Document(1, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(2, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(3, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(4, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(5, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(6, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(7, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(8, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(9, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(10, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
- $docs[] = new Elastica_Document(11, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
+ for ($i=0; $i < 11; $i++){
+ $docs[] = new Elastica_Document($i, array('id' => 1, 'email' => 'test@test.com', 'username' => 'test'));
+ }
+
$type = $index->getType('zeroType');
$type->addDocuments($docs);
$index->refresh();

0 comments on commit 15e1589

Please sign in to comment.