Currently when I search for something it displays the title of the node and if there is a match a small excerpt from either the content short summary or a small excerpt from the paragraph bundle. If there is no match it displays nothing.

How can i change this so it displays content even if only the title match. How can i change this so it displays the date it was published as well.

The modules involved are paragraphs, solr, searchAPI, Display Suite.

2 Answers 2


You can simply add a new view mode for search results:

  1. Go to admin/structure/types/manage/page/display (where "page" is your content type)
  2. Expand the Show Custom display settings fieldset
  3. Check Search index

Search index view mode

  1. Click Save
  2. Go to admin/structure/types/manage/page/display/search_index (where "page" is your content type)

My advice would be to use the Display Suite module as well for extra fields and more options.

  • Can you elaborate on Display Suite? I have that enabled but i'm not sure how to make it work.
    – blu
    Jan 10, 2017 at 20:00
  • I just updated my answer with more details. Jan 10, 2017 at 20:00
  • I followed the steps above and nothing seems to have changed from my search results page.
    – blu
    Jan 10, 2017 at 20:22
  • It would appear that you need the Apachesolr View Modes module as well: "Enables view modes to be used to control the display of search results". Jan 10, 2017 at 20:33
  • Display suite is a good solution. I had some difficulties at the beginning to configure it : layout must be selected to enable Display Suite functionality such as get search snippet field etc. Mar 22, 2018 at 14:14

I am assuming you're using Drupal 8. You'll want to modify the search-result.html.twig template. By default, I believe the code looks something like this:

{{ title_suffix }}
<p{{ content_attributes }}>{{ snippet }}</p>

You can modify it to display something like the node's body field summary:

{{ title_suffix }}
{% if result.node.body.0.summary %}
  <p{{ content_attributes }}>{{ summary|length > 200 ? summary|slice(0, 250) ~ '...' : summary }}</p>
  <div>{{ result.node.created }}</div>
{% else %}
  <p{{ content_attributes }}>{{ snippet }}</p>
  <div>{{ result.node.created }}</div>
{% endif %}

EDIT: formatting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.