Forum

Thread tagged as: Question, Problem, Installation

Search form not displaying results

Hi all

I was wondering if any one can help me please. I have a search form on my site and i cant seem to get the results to display. Nothing reads at all not even a "sorry, there are no results" text. I'm sure it's something that i have done but i cant seem to figure out what.

Any ideas would be a big help. I have supplied the code for search below:

<perch:before>
    <h1>Search results for “<perch:search id="search_key" />”</h1>

    <perch:if exists="paging">
        <p><perch:search id="total" /> results</p>
    </perch:if>
        <ul>
</perch:before>

        <li class="<perch:search id="perch_item_odd" />">
            <h2><a href="<perch:search id="result_url" />"><perch:search id="result_title" /></a></h2>
            <perch:if exists="result_excerpt"><p class="excerpt">…<perch:search id="result_excerpt" encode="false" />…</p></perch:if>
            <p><a href="<perch:search id="result_url" />">
                <perch:if exists="result_pageNavText">
                    <perch:search id="result_pageNavText" />
                <perch:else />
                    <perch:search id="result_url" />
                </perch:if>
                </a></p>
        </li>

<perch:after>
    </ul>

    <perch:if exists="paging">
        <div class="paging">
            Page <perch:search id="current_page" /> of <perch:search id="number_of_pages" />
            <perch:if exists="not_first_page">
                <a href="<perch:search id="prev_url" encode="false" />">Previous</a>
            </perch:if>
            <perch:if exists="not_last_page">
                <a href="<perch:search id="next_url" encode="false" />">Next</a>
            </perch:if>
        </div>
    </perch:if>
</perch:after>

SEARCH RESULTS.HTML

<perch:noresults>
    <perch:if exists="search_key">
        <h1>Search results for “<perch:search id="search_key" />”</h1>
    <perch:else />
        <h1>Search</h1>
    </perch:if>
    <perch:if exists="search_key">
        <p>Sorry, there are no results for “<perch:search id="search_key" />”.</p>
    </perch:if>
</perch:noresults> 

THIS IS WHAT I HAVE ON MY SEARCH.PHP PAGE

<?php 
  if (isset($_GET['q'])) {
    $query = $_GET['q'];  
  }else{
    $query = '';
  } 
  $opts = array(
    'count'=>5
  );
  perch_content_search($query,$opts); 
?>
Chris James

Chris James 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How much content do you have? What search terms are you using? How frequently do they appear in the content?

The whole site is perch managed. Search terms? how frequently? Sorry for my dumbness i'm new to this and I'm feeling my way around.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What terms are you searching for?