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.
Is it possible to keep the search module from indexing nodes that have not yet received moderator approval? The whole moderation thing becomes kind of useless if users can simply find and access the nodes through the search function.
Comment | File | Size | Author |
---|---|---|---|
#4 | modr8-search.patch | 485 bytes | lucascaro |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedInteresting question - I though the search results should respect the sql rewrite in terms of displaying results.
http://api.drupal.org/api/function/node_search/6
has:
So if that is not working, we need to figure out how to get the rewrite to be correct.
Comment #2
bryancasler CreditAttribution: bryancasler commentedSubscribing
Comment #3
pwolanin CreditAttribution: pwolanin commentedany more details about steps to reproduce?
Comment #4
lucascaro CreditAttribution: lucascaro commentedHi all, I've ran into the same issue, moderated modules were showing in the search results. The search operation seemed to be running twice. The first time, $query was empty and modr8's hook_db_rewrite_sql was not modifying the results. As a quick fix, I've changed line 217 of modr8.module from:
if (!$access && $query) {
to
if (!$access) {
I just hope I'm not breaking functionality here.
here's a patch for whoever wants to give it a try.
P.S. I'm using v 6.x-1.3
Comment #5
lucascaro CreditAttribution: lucascaro commentedHi again. As per http://www.lullabot.com/articles/hiding-content-drupals-search-system I think I'm not that wrong:
"Due to some curious code inside the node module, however, the query that's passed in is treated as empty. While that's a pretty big violation of Drupal's own coding standards, it makes it easy to intercept just the node search queries."
So that's basically how you rewrite search queries!