Pagerfanta icon indicating copy to clipboard operation
Pagerfanta copied to clipboard

[RFC] Lazy adapters implementation

Open Koc opened this issue 9 years ago • 5 comments

Use case: some databases/search engines aren't required execute two queries for getting count and slice. So we can use only one query for slice and count, but now it doesn't work properly, because Pagerfanta filters current page so early, before slice query executed.

For preventing +1 query I've created LazyAdapterInterface that marks adapter as lazy.

TODO:

  • [ ] documentation
  • [x] tests

Koc avatar Jun 26 '15 14:06 Koc

Example of lazy adapter for Sphinxsearch engine https://github.com/Koc/Sphinxy/blob/master/Pagerfanta/Adapter/SphinxyQbAdapter.php

Koc avatar Jun 26 '15 14:06 Koc

Looks interesting for elasticsearch, too:

For example: I need aggregations from PagerfantaAdpter which are the same on all pages.

EDIT: Your PR is missing the actual LazyAdapterInterface ?

mablae avatar Jun 26 '15 16:06 mablae

@mablae LazyAdapterInterface is present, but it is empty. It is just mark adapter as lazy.

Koc avatar Jun 27 '15 08:06 Koc

Tests have been added

Koc avatar Jun 29 '15 09:06 Koc

Unfortunately the problem with double queries is still relevant.

sauron918 avatar Feb 19 '19 08:02 sauron918