0

I am getting the correct search results when a user searches for a keyword. I have set the pagination limit to 12 and the first 12 searches results are shown as expected.

If a search has more than 12 results pagination is included. Although when I click a pagination link the next results page is not displaying the correct results. It is displaying 100+ results as the results of the search, regardless.

Below I have included my code:

Search Form

{exp:low_search:form collection="test-collection" search_mode="keywords" result_page="search/index"}</pre>
  <input placeholder="Search" type="text" name="keywords">
   <input type="submit">
{/exp:low_search:form}

Search Results

{exp:low_search:results 
     query="{segment_2}"
     channel="product_swatches"
     paginate="bottom"
     paginate_base="search" 
     limit="12"
}   
    <div class="swatch_listing">
            <figure>
              <img src="{product_image}" alt="{title}">
                 <figcaption>
                    <span>
                        {title}                     
                    </span>
                 </figcaption>
            </figure>
    </div>
    {paginate}
      <section id="pagination" class="clearfix">
         <div class="pg_prev">
            {if previous_page}
                <a href="{auto_path}">&laquo; Previous</a>
            {/if}
        </div>
        <div class="pg_list">
            {pagination_links}
                {page}
                   <a href="{pagination_url}" 
                      class="page-{pagination_page_number} 
                             {if current_page}active{/if}"
                    >   
                        {pagination_page_number}
                   </a>
                {/page}
            {/pagination_links}
        </div>     
        <div class="pg_next">
            {if next_page}
                <a href="{auto_path}">Next &raquo;</a>
            {/if}
        </div>
    </section>
  {/paginate}
  {if low_search_no_results}
     <p>There were no results for this search</p>
  {/if}
{/exp:low_search:results}
2
  • Please add the following info: what are your EE and LS versions? Are you encoding queries or using GET vars? Are you using Structure? If you change the low_search:results tag to a channel:entries tag, does the pagination work then?
    – Low
    Feb 25, 2015 at 14:30
  • Hi Low, ExpressionEngine 2.9.2, Low Search 3.5.2, I am using structure, I have tried query="{segment_2}" and I have tried changing the low "low_search:results" to a channel:entries tag, same results are displaying, page one has correct results and pagination has all results. Thanks for the quick reply
    – Sam Crowe
    Feb 25, 2015 at 15:07

1 Answer 1

1

It's not yet clear if you're encoding queries or not.

If you are, then having paginate_base="search" will not include the encoded query in the pagination links, and will therefore 'forget' the query. Try either using paginate_base="search/{segment_2}" or removing that parameter altogether.

Since you're using Structure, make sure the actual encoded query is passed on to the tag. Structure resets the segment vars, so you might need something like Freebie instead. Turn on Template debugging to see what the actual LS tag is when it gets parsed.

I have tried changing the low "low_search:results" to a channel:entries tag, same results are displaying, page one has correct results and pagination has all results

Now, this points to a non-Low Search issue, as the pagination is wrong for the native tag as well. I'd recommend trying it out on a non-Structure managed template and see if the problem persists then.

1
  • paginate_base="search/{segment_2}" This fixed the issue, excellent support. Thank you
    – Sam Crowe
    Feb 25, 2015 at 15:17

Your Answer

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

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