Skip to content

Commit 8107f47

Browse files
committed
Fix for paginate.
1 parent 4b65a50 commit 8107f47

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Nqxcode/LuceneSearch/Query/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function paginate($perPage = 25, $currentPage = null)
113113
$models = $this->get();
114114
$count = $this->count();
115115

116-
$paginator = App::make('paginator')->make($models, $count, $perPage);
116+
$paginator = App::make('paginator')->make($models->all(), $count, $perPage);
117117

118118
return $paginator;
119119
}

tests/functional/SearchTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,12 @@ public function testSearchHighlightResults()
9393
$highlighted = Search::highlight('все слова');
9494
$this->assertEquals('<span class="highlight">все</span> <span class="highlight">слова</span>', $highlighted);
9595
}
96+
97+
public function testSearchWithPaginate()
98+
{
99+
$query = Search::query('laser pointer', ['name', 'description']);
100+
$founded = $query->paginate(2, 2);
101+
102+
$this->assertEquals('broken pointer', $founded[0]->name);
103+
}
96104
}

0 commit comments

Comments
 (0)