Blog Search - Shows Just 1 Result

  • My blog search results are not really working. Here's what I have setup:


    1. The search page:

    PHP
    1. <?php
    2. perch_content_search(perch_get('q'), [
    3. 'apps' => ['PerchBlog'],
    4. 'sort' => 'postDateTime',
    5. 'count' => '9',
    6. 'template'=>'search-result.html',
    7. ]);
    8. ?>

    2. The "search-result.html" template referenced above is:

    3. The "blog_search_result.php" is:


    With all that, the results looks as the should style-wise, but even when the results show a total number of 100 for example, I'm only seeing one single result. The pagination is working. But it's as if I added a 'count' filter, but I didn't. What's missing here?


  • hi hus_hmd - here's the debug message after perform a search of "test" and getting 1 results as shown above:

  • Hi


    Unless your search-result.html template is redacted, it looks like your perch:before and perch:after tags aren't opening or closing respectively, so that's going to throw up some issues. Especially if you are looping over the search results and taking them into a layout page. It's only going to show one result.


    I am assuming here that there's a reason you are calling the layout blog_search_result.php, rather than just show the contents of the search result in the original template.

  • thanks ellimondo - I think you have it right! I have more results now, but they aren't laying out properly. Also when I paginate, the next pages are blank. So I imagine I have the perch:before and perch:after tags in the wrong spot?