53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* @file
|
|
* materio_search.rules_defaults.inc
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_default_rules_configuration().
|
|
*/
|
|
function materio_search_default_rules_configuration() {
|
|
$items = array();
|
|
$items['rules_update_node_on_term_save'] = entity_import('rules_config', '{ "rules_update_node_on_term_save" : {
|
|
"LABEL" : "update search_api indexes on term save",
|
|
"PLUGIN" : "reaction rule",
|
|
"TAGS" : [ "search api" ],
|
|
"REQUIRES" : [ "rules", "search_api", "taxonomy" ],
|
|
"ON" : [ "taxonomy_term_update" ],
|
|
"DO" : [
|
|
{ "entity_query" : {
|
|
"USING" : {
|
|
"type" : "node",
|
|
"property" : "field_onthologie",
|
|
"value" : [ "term" ],
|
|
"limit" : "9999999"
|
|
},
|
|
"PROVIDE" : { "entity_fetched" : { "nodes_to_index" : "Les noeuds \\u00e0 indexer" } }
|
|
}
|
|
},
|
|
{ "LOOP" : {
|
|
"USING" : { "list" : [ "nodes-to-index" ] },
|
|
"ITEM" : { "node_to_index" : "node a indexer depuis la liste" },
|
|
"DO" : [
|
|
{ "search_api_index" : {
|
|
"entity" : [ "node-to-index" ],
|
|
"index" : "materiaux_breves",
|
|
"index_immediately" : 0
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{ "search_api_index" : {
|
|
"entity" : [ "term" ],
|
|
"index" : "referencement",
|
|
"index_immediately" : 0
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}');
|
|
return $items;
|
|
}
|