0

We have the following on our results page:

{layout="site/.html-layout"}

{exp:low_search:results
query="{segment_2}"
require_query="yes"      
limit="20"
paginate="bottom"
status="not closed"
disable="member_data|category_fields"
}

{if count == 1}
<header class="page-header">
    <h1>
        {if get:collection}
            {if get:collection == "companies"}<a href="{path='companies'}">Company Directory</a> / Company {/if}
            {if get:collection == "dictionary"}<a href="{path='dictionary'}">Dictionary</a> / {/if}
        {/if}
        Search Results {if low_search_keywords} for <mark>&ldquo;{low_search_keywords}&rdquo;</mark>{/if} ({if absolute_results != 0}{absolute_results}{if:else}No{/if} result{if absolute_results != 1}s{/if})
    </h1>
</header>

<div class="row">
    <section class="col-md-8 col-md-offset-1 entries_list" style="margin-top: 30px; margin-bottom: 30px;">
        <div class="entries_list">
{/if}

{sn_results_entry_summary}

{if count == total_results}
        </div>
    </section>
</div>
{/if}

{paginate}
{pagination_links}
    <ul class="pagination">
      {first_page}
        <li><a href="{pagination_url}" class="page-first">&laquo;</a></li>
      {/first_page}
      {previous_page}
        <li><a href="{pagination_url}" class="page-previous">&lsaquo;</a></li>
      {/previous_page}
      {page}
        <li{if current_page} class="active"{/if}><a href="{pagination_url}" class="page-{pagination_page_number}">{pagination_page_number}</a></li>
      {/page}
      {next_page}
        <li><a href="{pagination_url}" class="page-next">&rsaquo;</a></li>
      {/next_page}
      {last_page}
        <li><a href="{pagination_url}" class="page-last">&raquo;</a></li>
      {/last_page}
      </ul><!-- / .pagination -->
  {/pagination_links}
{/paginate}

{if low_search_no_results}
<header class="page-header">
    <h1>Search Results {if low_search_keywords} for &ldquo;<mark>  {low_search_keywords}</mark>&rdquo;{/if} (No results)</h1>
</header>
<div class="bg-warning" style="padding: 20px 20px 10px 20px; ">
    <p>Sorry, there are currently no search results{if low_search_keywords} for &ldquo;<mark>{low_search_keywords}</mark>&rdquo;{/if}.</p>
</div>
{/if}<!-- low_search_no_results -->

{/exp:low_search:results}

This works fine on the first page, and we get the correct results, with an example URL of :

http://example.com/search/results/?collection=articles|case-studies|guides|products|videos|white-papers|dictionary|companies&keywords=test

When we click a pagination link, we get this URL :

http://example.comsearch/results/P20

Which returns no results.

Oddly on another site, with 90% the same code and no differences in results tags it works as we would expect.

We are running ExpressionEngine v2.8.1 - Build Date: 20140314 and LOW Search 3.1.5

--- EDIT ---

We've also tried revising the code so that:

The pagination href changes to: {pagination_url}{current_query_string}

Then a url such as http://example.com/search/results?collection=case-studies|guides|&keywords=test

becomes this when a pagination link clicked: http://example.com//search/results/P2collection=case-studies%7Cguides%7C&keywords=test

Which again fails.

  • {pagination_url}?{current_query_string} fixed it :) – paulcripps Nov 12 '14 at 21:39
2

Try upgrading Low Search to the latest version. Version 3.1.6 has this bugfix:

Fixed a bug where a page URL could be falsely rewritten to maintain the query string

...which should probably fix the issue.

If it does not, try changing the hrefs of the pagination links to:

href="{pagination_url}?{current_query_string}"
| improve this answer | |
  • We just upgraded to 3.3.0 and it does the same. – paulcripps Nov 12 '14 at 16:48
  • How about changing the hrefs from href="{pagination_url}" to href="{pagination_url}{current_query_string}"? – Low Nov 12 '14 at 16:49
  • Will try that. FYI we also checked this post expressionengine.stackexchange.com/questions/20033/… pagination works fine in the template using normal entries loop. – paulcripps Nov 12 '14 at 17:00
  • It's probably the way LS tries to rewrite the pagination URLs to include the query string. When it fails to do it correctly automatically (which seems the case here), using {current_query_string} should help. – Low Nov 12 '14 at 17:03
  • 1
    Oh, try href="{pagination_url}?{current_query_string}" then. – Low Nov 12 '14 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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