Skip to content

Commit 83489b1

Browse files
committed
Issue #501 resolved. Bulk path fixed
1 parent e362133 commit 83489b1

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

changes.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
CHANGES
22

3+
2013-12-01
4+
- Issue #501 resolved
5+
36
2013-11-23
47
- Release v0.90.7.0
58

lib/Elastica/Bulk.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ public function hasType()
119119
*/
120120
public function getPath()
121121
{
122-
$path = '/';
122+
$path = '';
123123
if ($this->hasIndex()) {
124-
$path.= $this->getIndex() . '/';
124+
$path .= $this->getIndex() . '/';
125125
if ($this->hasType()) {
126-
$path.= $this->getType() . '/';
126+
$path .= $this->getType() . '/';
127127
}
128128
}
129-
$path.= '_bulk';
129+
$path .= '_bulk';
130130
return $path;
131131
}
132132

test/lib/Elastica/Test/BulkTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,22 @@ public function testUpdate()
527527

528528
$index->delete();
529529
}
530+
531+
public function testGetPath() {
532+
$client = $this->_getClient();
533+
$bulk = new Bulk($client);
534+
535+
$this->assertEquals('_bulk', $bulk->getPath());
536+
537+
$indexName = 'testIndex';
538+
539+
$bulk->setIndex($indexName);
540+
$this->assertEquals($indexName . '/_bulk', $bulk->getPath());
541+
542+
$typeName = 'testType';
543+
$bulk->setType($typeName);
544+
$this->assertEquals($indexName . '/' . $typeName . '/_bulk', $bulk->getPath());
545+
}
530546

531547
public function udpDataProvider()
532548
{

0 commit comments

Comments
 (0)