Closed ndiego closed 4 months ago
It should be possible to return the total from ES, even if it isn't possible to paginate through all the results, as the total exists in the response. That would probably be better?
It should be possible to return the total from ES, even if it isn't possible to paginate through all the results, as the total exists in the response. That would probably be better?
Oh yeah, that would be better. Didn't think it was possible.
test
search is 5,552
results, as reported by the search api.
1,020
is 51 * 21, the display is limited to 50 pages which would be 1,000
, so it seems that there's an off-by-one in the pagination limiting code.
There's a logged-out 50 page limit plugin: https://github.com/WordPress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-page-limiter.php
The plugin directory search limits it to 50 pages, which seems odd: https://github.com/WordPress/wordpress.org/blob/86efbda99d43bb3603c082a8ed59912fc99be061/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-search.php#L401-L421
Disabling that leads to 51 pages being offered, the 1,020. So I guess the actual bug is in the upstream Jetpack code that sets it as 1020..
Let's see if this following change works to properly show the search result counter.
Looks like the numbers are accurately reflected in the search results from a few tests.
I wonder if we should consider a page that exists after 50 pages, something along the lines of "Please consider narrowing your search, results are limited to 1000"?
Let's see if this following change works to properly show the search result counter.
Looks like it's now showing the actual number of plugins 🙌
Can we close this issue now?
When searching in the Plugin Directory, the maximum number of returned search results is 1020. Because many search terms return 1020 results, and the number is so specific, it feels odd or that something is not working correctly. If the search maxes out at 1020, I propose we instead display
1,000+
.