I'm having a little bit of difficulty trying to sort a search result set returned by Low Search

The user has the option to enter keyword(s) as well as choose many search parameters, but result sorting options are not provided on search form page. On the results page there's a select list at the top to choose from various sorting options.

{exp:low_search:form form_id="searchResultsSort" query="{segment_3}" result_page="/the-register/new-results"}

  Sort by <select id="searchResultsSortSelect" name="orderby_sort">
    <option value="">Relevance</option>
    <option value="company_computed_rating|desc">Rating</option>
    <option value="company_date_registered|asc">Length of membership</option>
    <option value="company_membership_package|desc">Package level</option>


The problem is that the keyword(s) don't seem to be submitted since the result of this sorting is a longer result set and the Search Log shows no keywords.

Any thoughts?

2 Answers 2


After some experimentation I think I may have found the solution. I thought the Filters tag was just for reducing the result set, but it looks like it can be used for sorting/ordering as well:

{exp:low_search:filters query="{segment_3}"}
  <a href="{low_search:url toggle:orderby_sort="company_date_registered|asc"}">Length of membership</a>

Now to sort out the right JS to get this to work in a select list.

Edit: JS sorted. Here's the final result in case useful to anyone else:

<div id="searchResultsSort" class="clearfix">
  {exp:low_search:filters query="{segment_3}"}

    Sort by <select id="searchResultsSortSelect" name="orderby_sort">
      <option value="{low_search:url toggle:orderby_sort="search_count|desc"}">Relevance</option>
      <option value="{low_search:url toggle:orderby_sort="company_computed_rating|desc"}">Rating</option>
      <option value="{low_search:url toggle:orderby_sort="company_date_registered|asc"}">Length of membership</option>


and the JS:


The answer above didn't work for me - it required a minor amendment - in that the toggle parameter, when it already existed in the url, was appending the new orderby_sort value instead of replacing it.

I removed the toggle: prepend so that the parameter was replaced with the new value and it worked perfectly.

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.