diff --git a/core/modules/search/search.views.inc b/core/modules/search/search.views.inc new file mode 100644 index 0000000..a0207a8 --- /dev/null +++ b/core/modules/search/search.views.inc @@ -0,0 +1,129 @@ + array( + 'left_field' => 'nid', + 'field' => 'sid', + ), + ); + + $data['search_total']['table']['join'] = array( + 'node' => array( + 'left_table' => 'search_index', + 'left_field' => 'word', + 'field' => 'word', + ), + 'users' => array( + 'left_table' => 'search_index', + 'left_field' => 'word', + 'field' => 'word', + ) + ); + + $data['search_dataset']['table']['join'] = array( + 'node' => array( + 'left_table' => 'search_index', + 'left_field' => 'sid', + 'field' => 'sid', + 'extra' => 'search_index.type = search_dataset.type', + 'type' => 'INNER', + ), + 'users' => array( + 'left_table' => 'search_index', + 'left_field' => 'sid', + 'field' => 'sid', + 'extra' => 'search_index.type = search_dataset.type', + 'type' => 'INNER', + ), + ); + + $data['search_index']['score'] = array( + 'title' => t('Score'), + 'help' => t('The score of the search item. This will not be used if the search filter is not also present.'), + 'field' => array( + 'id' => 'search_score', + 'click sortable' => TRUE, + 'float' => TRUE, + 'no group by' => TRUE, + ), + 'sort' => array( + 'id' => 'search_score', + 'no group by' => TRUE, + ), + ); + + $data['search_node_links_from']['table']['group'] = t('Search'); + $data['search_node_links_from']['table']['join'] = array( + 'node' => array( + 'arguments' => array( + 'table' => 'search_node_links', + 'left_table' => 'node', + 'field' => 'nid', + 'left_field' => 'nid', + 'type' => 'INNER' + ), + ), + ); + $data['search_node_links_from']['sid'] = array( + 'title' => t('Links from'), + 'help' => t('Other nodes that are linked from the node.'), + 'argument' => array( + 'id' => 'node_nid', + ), + 'filter' => array( + 'id' => 'equality', + ), + ); + + $data['search_node_links_to']['table']['group'] = t('Search'); + $data['search_node_links_to']['table']['join'] = array( + 'node' => array( + 'arguments' => array( + 'table' => 'search_node_links', + 'left_table' => 'node', + 'field' => 'sid', + 'left_field' => 'nid', + 'type' => 'INNER' + ), + ), + ); + $data['search_node_links_to']['nid'] = array( + 'title' => t('Links to'), + 'help' => t('Other nodes that link to the node.'), + 'argument' => array( + 'id' => 'node_nid', + ), + 'filter' => array( + 'id' => 'equality', + ), + ); + + $data['search_index']['keys'] = array( + 'title' => t('Search Terms'), + 'help' => t('The terms to search for.'), + 'filter' => array( + 'id' => 'search', + 'no group by' => TRUE, + ), + 'argument' => array( + 'id' => 'search', + 'no group by' => TRUE, + ), + ); + + return $data; +}