Search api Solr onthologie bugfix
Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
c60696ba2b
commit
f9a60fe62d
@ -95,26 +95,28 @@ function materio_search_api_menu() {
|
||||
*/
|
||||
function materio_search_api_entity_property_info_alter(&$info){
|
||||
// dsm($info, 'hook_entity_property_info_alter | info');
|
||||
// watchdog('materio solr', 'materio_search_api_entity_property_info_alter', array());
|
||||
$properties = &$info['node']['properties'];
|
||||
for ($i=1; $i <= 5 ; $i++) {
|
||||
$properties['materio_search_api_taxonomy_term_'.$i] = array(
|
||||
'type'=>'taxonomy_term',
|
||||
'label'=> t('Main taxonomy term '.$i),
|
||||
'query callback'=>'entity_metadata_table_query',
|
||||
// 'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_main_taxonomy_term_'.$i,
|
||||
);
|
||||
}
|
||||
$properties['materio_search_api_taxonomy_term_'.$i] = array(
|
||||
'type'=>'taxonomy_term',
|
||||
'label'=> t('Taxonomy term after 5 mains'),
|
||||
'query callback'=>'entity_metadata_table_query',
|
||||
'getter callback'=>'materio_search_api_get_taxonomy_terms_after_5',
|
||||
);
|
||||
// $properties['materio_search_api_taxonomy_term_'.$i] = array(
|
||||
// 'type'=>'list<taxonomy_term>',
|
||||
// 'label'=> t('Taxonomy term after 5 mains'),
|
||||
// // 'query callback'=>'entity_metadata_table_query',
|
||||
// 'getter callback'=>'materio_search_api_get_taxonomy_terms_after_5',
|
||||
// );
|
||||
return $properties;
|
||||
}
|
||||
|
||||
function materio_search_api_get_main_taxonomy_term_1($item){
|
||||
// dsm($item, 'item');
|
||||
// watchdog('materio solr', 'materio_search_api_get_taxonomy_term_1', array());
|
||||
return materio_search_api_get_onto_term($item, 0);
|
||||
}
|
||||
function materio_search_api_get_main_taxonomy_term_2($item){
|
||||
@ -134,17 +136,25 @@ function materio_search_api_get_main_taxonomy_term_5($item){
|
||||
return materio_search_api_get_onto_term($item, 4);
|
||||
}
|
||||
|
||||
function materio_search_api_get_taxonomy_terms_after_5($item){
|
||||
if(isset($item->field_onthologie['und'])){
|
||||
$terms = array();
|
||||
foreach ($item->field_onthologie['und'] as $delta => $value) {
|
||||
if($delta>4)
|
||||
$terms[] = taxonomy_term_load($item->field_onthologie['und'][$delta]['tid']);
|
||||
}
|
||||
return $terms;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// function materio_search_api_get_taxonomy_terms_after_5($item){
|
||||
// // dsm($item, 'item');
|
||||
// watchdog('materio solr', 'materio_search_api_get_taxonomy_terms_after_5', array());
|
||||
// if(isset($item->field_onthologie['und'])){
|
||||
// $terms = array();
|
||||
// foreach ($item->field_onthologie['und'] as $delta => $value) {
|
||||
// if($delta>4){
|
||||
// $tid = $item->field_onthologie['und'][$delta]['tid'];
|
||||
// $terms[] = taxonomy_term_load($tid);
|
||||
// // $terms[] = $item->field_onthologie['und'][$delta];
|
||||
// // $terms[] = $value['tid'];
|
||||
// watchdog('materio solr', 'tid is '.$tid, array());
|
||||
// }
|
||||
// }
|
||||
|
||||
// return $terms;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
function materio_search_api_get_onto_term($item, $delta){
|
||||
// dsm($item, 'item');
|
||||
|
Loading…
x
Reference in New Issue
Block a user