0

The search is working fine however the search results are not being limited. Any ideas?

    {exp:search:simple_form 
        channel="about|approach|blog|job-ads|solutions|who_we_help" 
        search_in="entries"
        results="3"
        result_page="search" 
        no_result_page="search/no_results"
    }
        <input type="hidden" name="XID" value="{XID_HASH}" />
        <input id="keywords" name="keywords" placeholder="TYPE AND PRESS ENTER" type="text">
    {/exp:search:simple_form}
4
  • Can you clarify by what you mean when you say "not being limited"? By number (i.e. you're getting more than 3 results per page)? Or by channel? Also: no need to add the hidden XID input, the tag will generate that automatically. Jul 29, 2014 at 12:10
  • Limited by number
    – FuriousD
    Jul 29, 2014 at 23:09
  • SO how many results are you actually getting in your search:search_results tag? Jul 30, 2014 at 0:53
  • As many results as there are - there's no limit.
    – FuriousD
    Aug 1, 2014 at 4:24

2 Answers 2

0

I've just tried and everything looks fine to me. The only thing I can think of that was different in my code is the results_page parameter, I've got search/results instead of just search.

My code:

{exp:search:simple_form
    channel="my|channels"
    search_in="entries"
    results="3"
    result_page="search/results" 
    no_result_page="search/no_results"
  }

Maybe if you change your's to search/index?

3
  • I think you're on the right track, that his result_page parameter needs to be in template_group/template_name format, but his template structure is probably different: ellislab.com/expressionengine/user-guide/add-ons/search/… Jun 29, 2014 at 12:38
  • Also, doesn't the results page need a paginate tag? Jul 29, 2014 at 13:13
  • Good point Johnathan. The results parameter is the number of results per page, not the limit/total number of results. So as you said, setting pagination on the results page will change how many results are displayed at one time, but not the total number of results to display. I don't think you can actually limit the number of results as FuriousD is wanting to do. Good spot. Sep 11, 2014 at 12:55
0

If you can't add a limit= parameter, you can inside your {exp:search:search_results} tag limit by count:

{exp:search:search_results}
  {if count <= 3}
    {title}
  {/if}
{/exp:search:search_results}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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