Add to module Search API Integration.
Example implementation:


/**
 * Implements hook_entity_property_info_alter().
 */
function node_view_count_entity_property_info_alter(&$info) {
  if (isset($info['node']['bundles'])) {
    // For each content type.
    foreach ($info['node']['bundles'] as $bundle_type => $bundle) {

      $node_types = variable_get('node_view_count_node_types_options');
      if (!in_array($bundle_type, $node_types))
        return;

      $info['node']['bundles'][$bundle_type]['properties']['node_view_count'] = array(
        'label' => t('Node View Count'),
        'description' => t('The total number of views for this node.'),
        'type' => 'integer',
        'getter callback' => 'node_view_count_get_count',
        'computed' => TRUE,
      );
    }
  }
}

/**
 * Get the views count for a given node.
 */
function node_view_count_get_count($entity, $options, $name, $entity_type, &$info) {
  // Requiring type node since we're relying on $entity->nid,
  // but this could be used for user objects too.
  if ($entity_type == 'node') {
    $count = node_view_count_db_count_view_select($entity);
    if (!empty($count))
    {
      $count = reset($count)->expression;
    }
  }
  return !empty($count) ? $count : 0;
}

Comments

glendemon’s picture

Issue summary: View changes
Anonymous’s picture

Status: Active » Closed (works as designed)

Hello glendemon.
Thank you for your feedback.
We think it is not popular feature. You can do it in a custom module if you need this functional.