I am using apachesolr-7.x-1.0-rc4 and apachesolr_views-7.x-1.0-beta1. i am showing result with the help of apache solr view. Solr is indexing most of the fields of selected content type. But the value in content field contain the attached file name and node creation date (see screenshot). I just want that content field contain only body field of node.
solr content
solr content contain attached file

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nick_vh’s picture

Status: Active » Fixed

The content field is a node_render of the node.
You can change this in the UI : admin/structure/types/manage/NODE_TYPE/display/search_index (if you don't have the search index field display type, you can easily add it in the settings there.)

// Build the node body.
  $build = node_view($node, 'search_index', !empty($node->language) ? $node->language : LANGUAGE_NONE);
  // Remove useless html crap out of the render.
  unset($build['#theme']);
  $text = drupal_render($build);
  $document->content = apachesolr_clean_text($text);

I suggest you figure out how to alter the search_index render and take it from there. Or overwrite the content field in the hooks that are designed to so?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

abelass’s picture

I have the same issue, body field and another custom text field are merged into the content field but not available seperately. In which form/ui can this be done?

abelass’s picture

Issue summary: View changes

Forget about my message before. I managed to do with the hook hook_apachesolr_index_document_build_ENTITY_TYP