function recommender_views_data in Recommender API 7.3
Same name and namespace in other branches
- 6.3 views/recommender.views.inc \recommender_views_data()
- 6.2 recommender.views.inc \recommender_views_data()
- 7.6 recommender.views.inc \recommender_views_data()
- 7.4 recommender.views.inc \recommender_views_data()
- 7.5 recommender.views.inc \recommender_views_data()
Implements hook_views_data().
File
- ./
recommender.views.inc, line 11 - recommender.views.inc Views support for recommender tables
Code
function recommender_views_data() {
$data = array(
// for the recommender_app table
'recommender_app' => array(
'table' => array(
'group' => t('Recommender Application'),
'join' => array(
'recommender_similarity' => array(
'left_field' => 'app_id',
'field' => 'id',
'type' => 'inner',
),
'recommender_prediction' => array(
'left_field' => 'app_id',
'field' => 'id',
'type' => 'inner',
),
),
),
'name' => array(
'title' => t('Application name'),
'help' => t('Recommender application used to provide similarity/prediction data. Filtering is a little slower than using application id.'),
'filter' => array(
'handler' => 'views_handler_filter_recommender_app_name',
),
),
),
// for the recommender_similarity table
'recommender_similarity' => array(
'table' => array(
'group' => t('Recommender Similarity'),
'help' => t('Recommender similarity data between node-node and user-user'),
/*'join' => array(
'node' => array(
'left_field' => 'nid',
'field' => 'target_eid',
'type' => 'inner',
//'handler'
),
'users' => array(
'left_field' => 'uid',
'field' => 'target_eid',
'type' => 'inner',
),
),*/
// [#1191904] use base tables
'base' => array(
'field' => 'id',
'title' => t('Recommender Similarity'),
'help' => t('Recommender similarity data between node-node and user-user'),
),
),
'app_id' => array(
'title' => t('Application ID'),
'help' => t('Recommender application used to provide similarity data'),
'filter' => array(
'handler' => 'views_handler_filter_recommender_app_id',
),
),
'source_eid' => array(
'title' => t('Entity ID (Source)'),
'help' => t('The entity ID (node, user, etc) upon which this similarity is for.'),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
),
// // [#1191904] use base tables
'target_eid' => array(
'title' => t('Entity ID (Target)'),
'help' => t('The entity ID (node, user, etc) similar to the source entity.'),
'relationship' => array(
'base' => 'node',
'base field' => 'nid',
'handler' => 'views_handler_relationship_recommender_entity_type',
'label' => t('Recommended entity (by similarity)'),
),
),
'score' => array(
'title' => t('Similarity score'),
'help' => t('Score of how similar the source entity and the target entity are.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'updated' => array(
'title' => t('Updated'),
'help' => t('Last updated timestamp of this similarity score.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
),
),
// for the recommender_prediction table
'recommender_prediction' => array(
'table' => array(
'group' => t('Recommender Prediction'),
'help' => t('Recommender prediction data between user-node.'),
/*'join' => array(
'node' => array(
'left_field' => 'nid',
'field' => 'target_eid',
'type' => 'inner',
),
'users' => array(
'left_field' => 'uid',
'field' => 'target_eid',
'type' => 'inner',
),
),*/
// [#1191904] use base tables
'base' => array(
'field' => 'id',
'title' => t('Recommender Prediction'),
'help' => t('Recommender prediction data for node-user pairs.'),
),
),
'app_id' => array(
'title' => t('Application ID'),
'help' => t('Recommender application used to provide prediction data'),
'filter' => array(
'handler' => 'views_handler_filter_recommender_app_id',
),
),
'source_eid' => array(
'title' => t('Entity ID (Source)'),
'help' => t('The entity ID (node, user, etc) upon which this prediction is for.'),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
),
// [#1191904] use base tables
'target_eid' => array(
'title' => t('Entity ID (Target)'),
'help' => t('The entity ID (node, user, etc) recommended to the source entity.'),
'relationship' => array(
'base' => 'node',
'base field' => 'nid',
'handler' => 'views_handler_relationship_recommender_entity_type',
'label' => t('Recommended entity (by prediction)'),
),
),
'score' => array(
'title' => t('Prediction score'),
'help' => t('Score of how confident to recommend the target entity to the source entity'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'updated' => array(
'title' => t('Updated'),
'help' => t('Last updated timestamp of this prediction score.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
),
),
);
return $data;
}