docs/toolbox/paginators/searchkick.md
:searchkick is a SEARCH paginator for Searchkick::Results objects.
=== :icon-list-ordered: Setup
Searchkick.extend Pagy::Search
=== :icon-tools: Usage
+++ Active mode
!!!success Pagy searches and paginates
Use the pagy_search method instead of the search method.
!!!
extend Pagy::Search
# Single model
search = Article.pagy_search(params[:q])
# Multi models
search = Searchkick.pagy_search(params[:q], models: [Article, Categories])
# Paginate it
@pagy, @response = pagy(:searchkick, search, **options)
+++ Passive mode
!!!success You search and paginate Pagy creates its object out of your result. !!!
# Standard results (already paginated)
@results = Article.search('*', page: 1, per_page: 10, ...)
# Get the pagy object out of it
@pagy = pagy(:searchkick, @results, **options)
+++
!!! Search paginators don't query a DB, but use the same positional technique as :offset paginators, with shared options and readers. !!!
==- :icon-sliders: Options
search_method: :my_search
: Customize the name of the searchkick method to use (default :search).
{{ include "options/paginator" }}
==- :icon-mention: Readers
{{ include "snippets/offset-readers" }}
===