Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,23 @@ Typesense.configuration = {
}
```

### Pagination & Search in a controller with Pagy

```ruby
class ProductsController < ApplicationController
def index
# If `params[:q]` is blank, Typesense will automatically use "*" to return all documents
@pagy, @products = Product.search(params[:q], "name,description")
end
end
```

```erb
<h1>Search results for <%= params[:q] %></h1>
<%= render @products %>
<%== pagy_nav(@pagy) if @pagy.pages > 1 %>
```

## Testing

To run the test suite:
Expand Down