Example #1
0
 public function testSort()
 {
     $this->assertEquals(ESphinxSort::RELEVANCE, SPH_SORT_RELEVANCE);
     $this->assertEquals(ESphinxSort::ATTR_DESC, SPH_SORT_ATTR_DESC);
     $this->assertEquals(ESphinxSort::ATTR_ASC, SPH_SORT_ATTR_ASC);
     $this->assertEquals(ESphinxSort::TIME_SEGMENTS, SPH_SORT_TIME_SEGMENTS);
     $this->assertEquals(ESphinxSort::EXTENDED, SPH_SORT_EXTENDED);
     $this->assertEquals(ESphinxSort::EXPR, SPH_SORT_EXPR);
     $this->assertCount(6, ESphinxSort::items());
 }
 protected function applySortMode($mode, $sortBy = '')
 {
     $mode = (int) $mode;
     if (!ESphinxSort::isValid($mode)) {
         throw new ESphinxException("Sort mode {$mode} is undefined");
     }
     $this->sphinxClient->SetSortMode($mode, $sortBy);
 }