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 )
Comment | File | Size | Author |
---|---|---|---|
#1 | node_search_997976.patch | 370 bytes | bblake |
Comments
Comment #1
bblake CreditAttribution: bblake commentedPatch included
Comment #2
bblake CreditAttribution: bblake commentedComment #3
febbraro CreditAttribution: febbraro commentedsubscribe
Comment #4
agentrickardReally 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.Comment #5
joelcollinsdc CreditAttribution: joelcollinsdc commentedsubscribe
Comment #6
agentrickardMoving
Comment #7
adamdicarlo CreditAttribution: adamdicarlo commentedSubscribe.
Comment #8
rbayliss CreditAttribution: rbayliss commentedThis 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.
Comment #9
rafinskipg CreditAttribution: rafinskipg commentedSubscribe.
Comment #10
agentrickard@rafinskipg Please use the Follow button in the upper right instead. Otherwise you spam the rest of us.
Comment #11
rbayliss CreditAttribution: rbayliss commentedSorry, 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.
Comment #12
James Andres CreditAttribution: James Andres commentedSubscribe (sorry for the spam didn't know d.o had that follow button now).
Comment #13
jhodgdonThis is actually a duplicate of #1435834: Cannot alter search queries, tag added too late and was resolved by #1366020: Overhaul SearchQuery; make search redirects use GET query params for keywords in D8.