# Showing the Paragraph of a Search result

**URL:** <https://forum.getkirby.com/t/showing-the-paragraph-of-a-search-result/23085>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 8, 2021, 2:33pm UTC](https://forum.getkirby.com/t/showing-the-paragraph-of-a-search-result/23085 "2021-08-08T14:33:49Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 8, 2021, 6:01pm UTC](https://forum.getkirby.com/t/showing-the-paragraph-of-a-search-result/23085/4 "2021-08-08T18:01:05Z")

</div>

In the example where I used it at the time, my search was limited to title and text field. And I limited highlighting to the text field.

The code snippet is a function that can go into the controller or into a plugin `index.php`, then has to be called on the text field:

```auto
 <?php foreach ($results as $result) : ?>
  <li>
    <h2><a href="<?= $result->url() ?>"><?= $result->title() ?></a></h2>
    <?= getResultText($result->text(), $query) ?>
  </li>
<?php endforeach ?>

```

If you search through all possible fields, you would have to approach this differently.

---

_[View the full topic](https://forum.getkirby.com/t/showing-the-paragraph-of-a-search-result/23085)._
