Drupal force search index on update


/ Published in: PHP
Save to your folder(s)

force fields to be added to the search index on update


Copy this code and paste it in your HTML
  1. /**
  2. * Implementation of hook_nodeapi()
  3. * For adding additional data to search index
  4. *
  5. */
  6. function sitehelper_nodeapi(&$node, $op, $teaser, $page) {
  7. switch ($op) {
  8.  
  9. //Update search index with keyword fields contents
  10. case 'update':
  11. if($node->type == 'product') {
  12. //Add field data to be indexed.
  13. search_index($node->nid,'node', $node->field_search_keywords[0]['value']);
  14. }
  15. break;
  16. }
  17. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.