Skip to content

Commit 19bff8e

Browse files
committed
Improve docs
1 parent d947e88 commit 19bff8e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/api/keyset.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ less convenient for UIs.
3737
| Term | Description |
3838
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
3939
| `offset pagination` | Technique to fetch each page by changing the `offset` from the collection start.<br/>It requires two queries per page (or one if [countless](/docs/api/countless.md)): it's slow toward the end of big tables.<br/>It can be used for a rich frontend: it's the regular pagy pagination. |
40-
| `keyset pagination` | Technique to fetch the next page starting from the `latest` fetched record in an `uniquely ordered` collection.<br/>It requires only one query per page: it's very fast regardless the table size and position (if properly indexed). It has a very limited usage in frontend. |
40+
| `keyset pagination` | Technique to fetch the next page starting from the `latest` fetched record in an `uniquely ordered` collection.<br/>It requires only one query per page: it's very fast regardless the table size and position (if properly indexed). It has a very limited usage in frontend. |
4141
| `uniquely ordered` | When the concatenation of the values of the ordered columns is unique for each record. It is similar to a composite primary `key` for the ordered table, but dynamically based on the `keyset` columns. |
4242
| `set` | The `uniquely ordered` `ActiveRecord::Relation` or `Sequel::Dataset` collection to paginate. |
4343
| `keyset` | The hash of column/direction pairs. Pagy extracts it from the order of the `set`. |
44-
| `latest` | The hash of `keyset` attributes of the `latest` fetched record (from the latest page). Pagy decodes it from the `:page` variable, and uses it to filter out the already fetched records. |
44+
| `latest` | The hash of `keyset` attributes of the `latest` fetched record (from the latest page). Pagy decodes it from the `:page` variable, and uses it to filter out the records already fetched. |
4545
| `next` | The next `page`, i.e. the encoded reference to the last record of the **current page**. |
4646
| `page` | The current `page`, i.e. the encoded reference to the `latest` record of the **latest page**. |
4747

@@ -97,7 +97,8 @@ Depending on your order requirements, here is how you set it up:
9797

9898
+++ No order requirements
9999
!!!success
100-
If you don't need any ordering, `order(:id)` is the simplest choice, because it's unique and already indexed. It works fast out of the box without any setup.
100+
If you don't need any ordering, `order(:id)` is the simplest choice, because it's unique and already indexed. It is fast out
101+
of the box without any setup.
101102
!!!
102103

103104
+++ Specific order requirements
@@ -239,7 +240,7 @@ They may have been stored as strings formatted differently than the default form
239240
!!! Success
240241

241242
- Ensure that the composite index reflects exactly the columns sequence and order of your keyset
242-
- Research about your specific DB features: type of index and performance for different ordering: use SQL `EXPLAIN ANALYZE`
243+
- Research about your specific DB features, type of index and performance for different ordering. Use SQL `EXPLAIN ANALYZE`
243244
or similar tool to confirm.
244245
- Consider using the same direction order, enabling the `:tuple_comparison`, changing type of index (different DBs may behave
245246
differently)

docs/extras/keyset.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ set = Product.order(brand: :asc, model: :desc, id: :asc)
5151
@pagy, @records = pagy_keyset(set, **vars)
5252

5353
# URL Helpers
54-
pagy_keyset_first_url_page(@pagy, absolute: true)
54+
pagy_keyset_first_url(@pagy, absolute: true)
5555
#=> "http://example.com/foo?page"
5656

57-
pagy_keyset_next_url_page(@pagy)
57+
pagy_keyset_next_url(@pagy)
5858
#=> "/foo?page=eyJpZCI6MzB9"
5959
```
6060

0 commit comments

Comments
 (0)