Use Search Engine

The Tea Theme Options is provided with a list of plugins, such as a super powerfull Search Engine which uses ElasticSearch.
Here is how to display results from the Search Engine.

<?php
  //Get results from Tea_Theme_Options, instance of `$tea` variable.
  $results = $tea->search()->searchContents();
?>
<?php if ($results['total']): ?>
  <aside class="filter-search">
    <ul>
      <?php foreach ($results['types'] as $typ): ?>
        <li><?php echo $typ ?> (<?php echo count($results['results'][$typ]) ?>)</li>
      <?php endforeach ?>
    </ul>
  </aside>

  <section class="results">
    <?php foreach ($results['results'] as $type => $type_res): ?>
      <h2><?php echo sprintf(__('%s (%d)'), $type, count($type_res)) ?></h2>
      <div class="row">
        <?php foreach ($type_res as $res): ?>
          <?php
            //Get source and score.
            $score = $res['score'];
            $source = $res['source'];
            //Get datas.
            $id = $source['id'];
            $title = $source['title'];
            $content = $source['content'];
            //Include template.
            if ('category' == $type || 'post_tag' == $type) {
              $link = get_term_link(intval($id), $type);
          ?>

<article class="article" itemscope itemtype="http://schema.org/BlogPosting">
  <h3 itemprop="name"><?php echo $title ?> (<?php echo $score ?>)</h3>
  <?php if (!empty($content)): ?>
    <div class="media-content" itemprop="headline"><?php echo $content ?></div>
  <?php endif ?>
  <a href="<?php echo $link ?>" title="<?php echo esc_html($title) ?>" itemprop="url"><?php _e('See all') ?></a>
</article>

        <?php
            }
            else if ('post' == $type) {
              $date = isset($source['date']) ? date('j F Y à H:i', strtotime($source['date'])) : date('j F Y à H:i');
              $excerpt = isset($source['excerpt']) ? $source['excerpt'] : '';
              $link = get_permalink($id);
              //get author datas
              $author = array(
                'id' => $source['author'],
                'name' => get_the_author_meta('display_name', $source['author']),
                'link' => get_author_posts_url($source['author'])
              );
              //get date datas
              $date = array(
                'complete' => date('c', strtotime($source['date'])),
                'display' => date('j F Y à H:i', strtotime($source['date']))
              );
          ?>

<article class="article" itemscope itemtype="http://schema.org/BlogPosting">
  <aside class="post-categories" itemprop="keywords">
    <ul>
      <?php get_the_term_list($id, 'category', '<li>', ',</li><li>', '</li>') ?>
    </ul>
  </aside>

  <?php if (has_post_thumbnail($id)):
    $image = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'thumbnail');
  ?>
    <a href="<?php echo $link ?>" title="<?php echo esc_html($title) ?>" class="thumbnail" itemprop="url">
      <img src="<?php echo $image[0] ?>" alt="" width="<?php echo $image[1] ?>" height="<?php echo $image[2] ?>" />
    </a>
  <?php endif ?>

  <h3 itemprop="name"><?php echo $title ?> (<?php echo $score ?>)</h3>
  <span class="media-time">
    <?php echo sprintf(
      __('By <a href="%s" itemprop="author">%s</a> on <time datetime="%s" itemprop="datePublished">%s</time>'),
      $author['link'],
      $author['name'],
      $date['complete'],
      $date['display']
    ); ?>
  </span>

  <div class="media-content" itemprop="headline"><?php echo $excerpt ?></div>
  <a href="<?php echo $link ?>" title="<?php echo esc_html($title) ?>" itemprop="url"><?php _e('Read more') ?></a>
</article>

        <?php
            }
          ?>
        <?php endforeach ?>
      </div>
    <?php endforeach ?>
  </section>
<?php else: ?>
  <section class="results">
    <div class="row">
      <p><?php _e('Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.') ?></p>
    </div>
  </section>
<?php endif ?>