Skip to content

Commit 88602c2

Browse files
committed
Merge pull request #85 from Dewstar/master
Added showIndexStatus & flushRamchunk to Helper class
2 parents a7dc993 + c42175c commit 88602c2

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,5 @@ $result = SphinxQL::create($this->conn)
395395
* `Helper::create($conn)->attachIndex($disk_index, $rt_index)`
396396
* `Helper::create($conn)->flushRtIndex($index)`
397397
* `Helper::create($conn)->optimizeIndex($index)`
398+
* `Helper::create($conn)->showIndexStatus($index)`
399+
* `Helper::create($conn)->flushRamchunk($index)`

src/Helper.php

+24
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,28 @@ public function optimizeIndex($index)
287287
{
288288
return $this->query('OPTIMIZE INDEX '.$this->getConnection()->quoteIdentifier($index));
289289
}
290+
291+
/**
292+
* SHOW INDEX STATUS syntax
293+
*
294+
* @param $index
295+
*
296+
* @return SphinxQL A SphinxQL object ready to be ->execute();
297+
*/
298+
public function showIndexStatus($index)
299+
{
300+
return $this->query('SHOW INDEX '.$this->getConnection()->quoteIdentifier($index).' STATUS');
301+
}
302+
303+
/**
304+
* FLUSH RAMCHUNK syntax
305+
*
306+
* @param $index
307+
*
308+
* @return SphinxQL A SphinxQL object ready to be ->execute();
309+
*/
310+
public function flushRamchunk($index)
311+
{
312+
return $this->query('FLUSH RAMCHUNK '.$this->getConnection()->quoteIdentifier($index));
313+
}
290314
}

tests/SphinxQL/HelperTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,11 @@ public function testMiscellaneous()
186186

187187
$query = Helper::create($this->conn)->optimizeIndex('rt');
188188
$this->assertEquals('OPTIMIZE INDEX rt', $query->compile()->getCompiled());
189+
190+
$query = Helper::create($this->conn)->showIndexStatus('rt');
191+
$this->assertEquals('SHOW INDEX rt STATUS', $query->compile()->getCompiled());
192+
193+
$query = Helper::create($this->conn)->flushRamchunk('rt');
194+
$this->assertEquals('FLUSH RAMCHUNK rt', $query->compile()->getCompiled());
189195
}
190196
}

0 commit comments

Comments
 (0)