Download & Extend

Remove private nodes from search results

Project:Private
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

It would seem that private nodes still show up in search results, could add a feature that removes private nodes from being indexed by the search module?

Comments

#1

Priority:normal» critical

I can confirm. Can this be fixed ASAP? Marking as critical, as they aren't really private if someone can pull them up in a search.

#2

well....how does can be possible to edit this module node access rules to avoid private nodes to show in search?

#3

hook_update_index() might work?

#4

What about simply calling search_touch_node($nid) for the node whose privacy setting was just changed? It causes the revision timestamp of the specified node to be set to the current time, which will result in the node then being reindexed by Drupal.

http://api.drupal.org/api/function/search_touch_node/6

#5

Calling hook_update_index() could be very expensive, and is certainly overkill for the sake of only one node.

#6

I believe the fixes are as follows: (note last line of each function)

/**
* Implementation of a Drupal action.
*/
function private_set_public_action(&$node, $context = array()) {
  $node->private = FALSE;
  $nids = array($node->nid);
  private_node_mark_public($nids);
  search_touch_node($node->nid); /* force reindexing of node by changing its revision timestamp */
}


/**
* Implementation of a Drupal action.
*/
function private_set_private_action(&$node, $context = array()) {
  $node->private = TRUE;
  $nids = array($node->nid);
  private_node_mark_private($nids);
  search_touch_node($node->nid); /* force reindexing of node by changing its revision timestamp */
}

I'll create a patch if this tests successfully.

#7

@bdhowell, I'm not understanding how your code fulfills our needs. From what I can see, it will only cause the node to be re-indexed, while what we want is for the node to not be indexed at all.

#8

Hi,

I was just wondering... It's true that we don't want the node to appear in search results for other people, but we still want it in our own search results, don't we ?
So I think it's more complicated than just removing the node from the index, or something like that. Anyway, maybe removing it from the index is the easier way to achieve such a functionnality.

My 2 cents,

#9

is it not simpler to check before display the node in the search result if the current user has permission to access the node?

nobody click here