Closed merk closed 4 years ago
I'm fine with any change done making pagination usable even without the support for hybrid objects. In my application I want to use pagination but didn't implemented it yet because of the lacking support of hybrid results in pagination.
+1 for pagination this way @merk
:+1:
+1 for aggregation support
Interesting, I don't see clearly here how aggregation is supported tho?
Of note here: KnpPaginator already supports Elastica Queries natively with both pagination and sortable features.
I have just submitted a PR to Pagerfanta that adds native support as well. https://github.com/whiteoctober/Pagerfanta/pull/146
I will try to get the transformation functionality listed in this PR merged into 3.1-dev tonight.
I'm going to need to make more changes to the Transformers to handle the {{ object | transform() }} helper without suffering a large number of loops. That wont happen tonight.
+1
@merk, I tested its proposal with a structure: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#_example
And it did not work, you suggest something?
We've got a few outstanding PRs to add aggregations or other features available to Elastica into our Pagination interfaces, but to me this exposes that the interfaces of this bundle are not flexible and need to be improved.
I propose the following way I believe that pagination should work:
It may be possible to adjust the api slightly to avoid the need to create a Search object and accept a SearchableInterface object that we would convert internally into a Search object.
I also face problems with this implementation - the return values that we can return. For 3.2 or 4.0 I plan on removing our Hybrid results completely, and instead only return the Elastica ResultSet containing only Elastica Result objects. I hope to have a method, getTransformed() on the Result to return the transformed object. This cant be done for 3.1.
The only option I can think of that lets me keep some level of forward compatibility without forcing you all to make changes is:
I would appreciate feedback from those that actually use pagination, since in my applications I dont paginate search results.