Problem with displaying field using Views My goal is to use Search API so that I can create a custom search page using Views.  I want to add the "rating" widget (rate module), but there is no way to include it in the Search API fields. Thus, I tried to fix it by adding custom field to Search API index.

function rate_entity_property_info_alter(&amp;$info) {
  $info['node']['properties']['widget'] = array(
    'label' =&gt; t('Rating widget'),
    'description' =&gt; t('Rating widget'),
    'getter callback' =&gt; 'display_widget',
  );
}
function display_widget($node) {
     print rate_generate_widget('1', 'node', $node-&gt;nid);
}


However, I am getting AJAX errors 



and problems with displaying widgets.



Please can someone help me to solve this problem.

Thanks
If this is a Solr/ElasticDB search backend under Search API, you could try this approach.

Create a view mode on the node type (ex. Search Result), then create a template with the html markup when rendered for it. Include all the fields in the display and configure the formatters as you want them.

Next, install Search API View Modes, and configure that view mode to be indexed. It will render that node before indexing it into a new field (search server side). Then, you can create a view display that shows that field, which is just HTML, and bypass some of these issues.

I use this method in every Search API based search I encounter. You're basically storing the rendered HTML on the search server, then printing that as the result.

I can't tell if you are on Drupal 7 or 8. Note that the 8.x branch 'works' but may have some bugs. I have only been able to test simple setups and not use it on production like the 7.x branch.