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.

CommentFileSizeAuthor
#4 modr8-search.patch485 byteslucascaro
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

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.

bryancasler’s picture

Subscribing

pwolanin’s picture

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

any more details about steps to reproduce?

lucascaro’s picture

FileSize
485 bytes

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

lucascaro’s picture

Category: support » bug
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!