-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination #26
Comments
Should I do this with offset/limit or should I do proper keyset pagination? I think keyset because then it will work well for the full search interface with no filters or search string. |
It feels a bit weird to implement keyset pagination against results sorted by I may just ignore that though. If you want reliable pagination you can get it by sorting by date. Maybe it doesn't even make sense to offer pagination if you sort by relevance? |
I'm going to try for keyset pagination sorted by relevance just as a learning exercise. |
It's a shame Datasette doesn't currently have an easy way to implement sorted-by-rank keyset-paginated using a TableView or QueryView. I'll have to do this using the custom SQL query constructed in the plugin: dogsheep-beta/dogsheep_beta/__init__.py Lines 8 to 43 in bed9df2
|
Datasette's implementation is complex because it has to support compound primary keys: https://github.com/simonw/datasette/blob/a258339a935d8d29a95940ef1db01e98bb85ae63/datasette/utils/__init__.py#L88-L114 - but that's not something that's needed for dogsheep-beta. |
If previous page ended at select
search_index.rowid,
search_index.type,
search_index.key,
search_index.title,
search_index.category,
search_index.timestamp,
search_index.search_1
from
search_index
where
date("timestamp") = '2018-02-11'
and timestamp < '2018-02-11T16:32:53+00:00'
order by
search_index.timestamp desc, rowid
limit 41 |
Actually for the tie-breaker it should be something like https://latest.datasette.io/fixtures?sql=select+pk%2C+created%2C+planet_int%2C+on_earth%2C+state%2C+city_id%2C+neighborhood%2C+tags%2C+complex_array%2C+distinct_some_null+from+facetable+where+%28created+%3E+%3Ap1+or+%28created+%3D+%3Ap1+and+%28%28pk+%3E+%3Ap0%29%29%29%29+order+by+created%2C+pk+limit+11&p0=10&p1=2019-01-16+08%3A00%3A00 where
(
created > :p1
or (
created = :p1
and ((pk > :p0))
)
) But with |
Useful for #16 (timeline view) since you can now filter to just the items on a specific day - but if there are more than 50 items you can't see them all.
The text was updated successfully, but these errors were encountered: