Пример #1
0
 /**
  * Execute the current query and return the total number of results.
  *
  * @return int
  */
 public function count()
 {
     $total = $this->runner->getCachedTotal($this->query);
     if (null === $total) {
         $total = $this->runner->total($this->query);
         $this->runner->setCachedTotal($this->query, $total);
     }
     return $total;
 }
 /**
  * Execute the current query and return the total number of results.
  *
  * @return int
  */
 public function count()
 {
     $this->filter->applyFilters($this->query);
     $count = $this->runner->getCachedCount($this->query);
     if ($count === null) {
         $count = count($this->runner->models($this->query));
     }
     return $count;
 }
Пример #3
0
 /**
  * Highlight matches in HTML fragment.
  *
  * @param string $html
  * @return string
  */
 public function highlight($html)
 {
     $highlighted = '';
     $lastQuery = $this->queryRunner->getLastQuery();
     if (!empty($lastQuery)) {
         $this->analyzerConfig->setHighlighterAnalyzer();
         $highlighted = $lastQuery->htmlFragmentHighlightMatches($html, 'utf-8', $this->highlighter);
         $this->analyzerConfig->setDefaultAnalyzer();
     }
     return !empty($highlighted) ? $highlighted : $html;
 }
 public function testDelete()
 {
     $model = m::mock('Illuminate\\Database\\Eloquent\\Model');
     $this->search->shouldReceive('delete')->with($model)->once();
     $this->runner->delete($model);
 }