Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299005

Search specific tags are not available and hook_query_TAG_alter hooks are not invoked

$
0
0

Problem/Motivation

In node_search_execute() there is this:

<?php
$query
= db_select('search_index', 'i', array('target'=> 'slave'))->extend('SearchQuery')->extend('PagerDefault');
?>

So there are two query extenders, each decorating the last. Pager needs to be last for paging to work correctly.

However, when execute() is called from PagerDefault, preExecute() is then called before execute() is called on the decorated extender (SearchQuery in this case) object. SearchQuery relies on adding a search_* tag in its execute() method.

By this point preExecute() has already been called from PagerDefault - this then runs hook_query_alter() and any hook_query_TAG_alter()s based on the tags. At this point the search_* tag has not yet been added. So unfortunately, E.g. hook_query_search_node_alter() will never get invoked. Also, hook_query_alter() implementations will never see the search_* tag.

Proposed resolution

Move the adding of search_* tags to preExecute() instead.

Remaining tasks

User interface changes

API changes


Viewing all articles
Browse latest Browse all 299005

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>