Download & Extend

How to omit nodes under moderation from search?

Project:modr8
Version:6.x-1.x-dev
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

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.

Comments

#1

Interesting 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:

      list($join1, $where1) = _db_rewrite_sql();

So if that is not working, we need to figure out how to get the rewrite to be correct.

#2

Subscribing

#3

Version:6.x-1.1» 6.x-1.x-dev
Status:active» postponed (maintainer needs more info)

any more details about steps to reproduce?

#4

Hi 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

AttachmentSize
modr8-search.patch 485 bytes

#5

Category:support request» bug report
Status:postponed (maintainer needs more info)» needs review

Hi 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!

nobody click here