materio_search.rules_defaults.inc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * @file
  4. * materio_search.rules_defaults.inc
  5. */
  6. /**
  7. * Implements hook_default_rules_configuration().
  8. */
  9. function materio_search_default_rules_configuration() {
  10. $items = array();
  11. $items['rules_update_node_on_term_save'] = entity_import('rules_config', '{ "rules_update_node_on_term_save" : {
  12. "LABEL" : "update search_api indexes on term save",
  13. "PLUGIN" : "reaction rule",
  14. "TAGS" : [ "search api" ],
  15. "REQUIRES" : [ "rules", "search_api", "taxonomy" ],
  16. "ON" : [ "taxonomy_term_update" ],
  17. "DO" : [
  18. { "entity_query" : {
  19. "USING" : {
  20. "type" : "node",
  21. "property" : "field_onthologie",
  22. "value" : [ "term" ],
  23. "limit" : "9999999"
  24. },
  25. "PROVIDE" : { "entity_fetched" : { "nodes_to_index" : "Les noeuds \\u00e0 indexer" } }
  26. }
  27. },
  28. { "LOOP" : {
  29. "USING" : { "list" : [ "nodes-to-index" ] },
  30. "ITEM" : { "node_to_index" : "node a indexer depuis la liste" },
  31. "DO" : [
  32. { "search_api_index" : {
  33. "entity" : [ "node-to-index" ],
  34. "index" : "materiaux_breves",
  35. "index_immediately" : 0
  36. }
  37. }
  38. ]
  39. }
  40. },
  41. { "search_api_index" : {
  42. "entity" : [ "term" ],
  43. "index" : "referencement",
  44. "index_immediately" : 0
  45. }
  46. }
  47. ]
  48. }
  49. }');
  50. return $items;
  51. }