Queries in modules/search/search.extender.inc have a tag appended to them so they can be modified:
$this
->addTag('search_' . $this->type)

However, the basic node search query has no such parameter. I propose adding a 'search_node' tag to the basic node search query so that it can be modified using hook_query_search_node_alter ( as opposed to a basic hook_query_alter which would be more inefficient than a more targeted alter function )

CommentFileSizeAuthor
#1 node_search_997976.patch370 bytesbblake
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bblake’s picture

FileSize
370 bytes

Patch included

bblake’s picture

Status: Active » Needs review
febbraro’s picture

subscribe

agentrickard’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Really smart patch.

Should also apply this to user_search_execute. Needs a documentation patch to the .api files and a test to see that the query can be altered when tagged.

joelcollinsdc’s picture

subscribe

agentrickard’s picture

Version: 7.0-rc1 » 8.x-dev
Issue tags: +Needs backport to D7

Moving

adamdicarlo’s picture

Subscribe.

rbayliss’s picture

Queries in modules/search/search.extender.inc have a tag appended to them so they can be modified:
$this
->addTag('search_' . $this->type)

However, the basic node search query has no such parameter.

This feels like a bug in SearchQuery... it is adding the tag too late. In PagerDefault, the tag is added in the constructor so that it is always in place when preExecute is called. I'd propose a single fix to SearchQuery over patching the *_search functions individually.

rafinskipg’s picture

Subscribe.

agentrickard’s picture

@rafinskipg Please use the Follow button in the upper right instead. Otherwise you spam the rest of us.

rbayliss’s picture

Sorry, forgot to update this ticket, but I created a new issue for the approach I suggested above and submitted a patch there: #1435834: Cannot alter search queries, tag added too late.

James Andres’s picture

Subscribe (sorry for the spam didn't know d.o had that follow button now).

jhodgdon’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)