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}
  • 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. – Derek Hogue Jul 29 '14 at 12:10
  • Limited by number – FuriousD Jul 29 '14 at 23:09
  • SO how many results are you actually getting in your search:search_results tag? – Derek Hogue Jul 30 '14 at 0:53
  • As many results as there are - there's no limit. – FuriousD Aug 1 '14 at 4:24

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?

  • 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/… – Romans-8---31-39 Jun 29 '14 at 12:38
  • Also, doesn't the results page need a paginate tag? – Johnathan Waters Jul 29 '14 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. – Laura Montgomery Sep 11 '14 at 12:55

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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