LMFDB / lmfdb

L-Functions and Modular Forms Database
Other
241 stars 198 forks source link

Paging for search #3334

Open DenaZH opened 4 years ago

DenaZH commented 4 years ago

When a list of examples show up with a search, it would be nice to have a first page & last page option in addition to previous and next buttons.

roed314 commented 4 years ago

First button is pretty easy.

The last button is more complicated, though doable if we decide we want it. It will require computing the total number of results (which can take a little while in some cases). Then a large offset takes a longer time for the SQL query to execute. To get an idea of what the performance would look like, compare

Given the performance issue, I'm not sure we should implement either button, but I'm willing to be convinced.

DenaZH commented 4 years ago

I see. The second link doesn't even open for me (it took too long to load and eventually shows an error msg). Maybe just a first button for now would be good enough. Thanks!

alexjbest commented 4 years ago

I like this idea. Currently I end up doing the following often : clicking the "of more than 1000" button to see the total number of results, rounding it down to the nearest 50 moving to the second page so that the url has the start=50 in it and then changing 50 to the number I just worked out. Seeing as people are probably doing this anyway (if they worked out how) I dont see why we should make people jump through hoops just because its not performant. (Unless you are worried about web scrapers and crawlers pressing the button regularly, but they aren't going inputing complex queries anyway probably).