0

I want to remove the limit of character imposed from Drupal 7 on the search result page. That is, displaying my result in full rather than truncating the results and adding ... at the beginning and end of the result. I already have a search-results.tpl.php in my templates and looks like that:

<?php if ($search_results): ?>
<?php print $search_totals.' << '.str_replace('%20',' ',basename($_SERVER['REQUEST_URI'])).'>>';?>
  <ol class="search-results test <?php print $module; ?>-results">
    <?php print $search_results; ?>
  </ol>
  <?php print $pager; ?>
<?php else : ?>
  <h2><?php print t('Your search yielded no results');?></h2>
  <?php print search_help('search#noresults', drupal_help_arg()); ?>
<?php endif; ?>

How can I prevent the results from being truncated?

1

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 (again, where "page" is your content type)

My advice would be to use download the Display Suite module (and enable the Display Suite module and Display Suite UI module) for extra fields and more options. No custom theming or coding required!

| improve this answer | |
  • Ok i have installed ds module...now what should i do? – Abdallah Boodhun Jan 17 '17 at 13:38
  • Just follow the steps as described in my answer, you should be fine. – Wim Mostrey Jan 17 '17 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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