Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Right now I have return;
in views_optimized_views_pre_execute() commented out; in regards to the pager. I think hook_views_optimized_view_optimize could return something that controls if we want to force this to run even if the pager isn't used .
Comment | File | Size | Author |
---|---|---|---|
#1 | views_optimized-pager-1185260-1.patch | 1.17 KB | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedComment #2
Fabianx CreditAttribution: Fabianx commentedHi,
Thanks for the patch. While I like the approach, I think we can do better.
I think the following things should be done here:
* return an array with information
** which also includes the functions to call for _get_orderby, _get_fields, which removes the redundant checks in the hooks.
In that information array have the level of optimization set (all queries, only with pager, etc.) with the maximum winning, and also allow modules to override the default of 1000 rows as there may be queries, which can be optimized and be faster even with 10000 rows or more.
This could look like:
Thoughts? Would that API work and be flexible enough?
Best Wishes,
Fabian
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedWhy call another set of functions? Have this all in one hook, and pass back the field and order by info. Also different views displays can have different filters, so adding a secondary filter on
$view->current_display
in the examples might be a good idea.