Today I was tasked with added pagination to search results for an Expression Engine site. Piece of cake! Or so I thought.
Ellis Labs, the creators of Expression Engine, did an amazing job with the documentation for their other project CodeIgniter, but I find the Expression Engine docs to be somewhat lacking. For example, there is no mention of how to set the number of search results to return on search results page. I believe the default is 50, but if that’s more than you want, which was the case today, there is no explanation (that I could find), in the documentation, wiki or forums for how to achieve this. Please point it out if you can find it.
After a little digging into the search class I managed to find the answer, and I thought I’d share it here. Quite simply, all you need to do is add a hidden field to the search form to set the post variable “RES” to the number of results you want.
eg. <input type="hidden" name="RES" value="25"> - will return 25 results per page.
Hope this helps!
Ladies and gentlemen, the afore mentioned