Open calebsmithdev opened 9 years ago
Can you describe in more detail what kind of scenarios you tried and why they were unsuccessful?
Sorry for the delayed response - So I am doing a search through a database of games with the code below:
Game::search($search, ['fields' => ['game.title'=> 'text_middle']])->getRecords();
This will ultimately pull the search and show all of the results - as expected. But I am unable to paginate those results from that code directly, or add any extra chains with that code for the most part.
I'd be interested in this as well, generally how to use pagination in Larasearch.
I see we can pass a limit
, padding
and offset
as an option to the search()
, but didn't dig deeper how it's plugging into the Laravel pagination.
BTW the link in the wiki (https://github.com/iverberk/larasearch/wiki/Searching#pagination) is dead.
Cheers!
I did it like this
$params['offset'] = $offset;
$params['limit'] = $limit;
$params['sort'][ Input::get('sort', '_score') ]['order'] = Input::get('order', 'desc');
$results = Series::search(\Input::get('title', '*'), $params);
$series = \Paginator::make($results->getResults()->toArray(), $results->getTotal(), $limit);
Paginator on L5 ?
\Paginator::make no more on L5.
I tried some variations to use getRecords with Eloquent and paginate, but I was unsuccessful. Has anyone tried to paginate search terms - whether through getRecords or getResults?