All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

How to order low search results by date, relevance etc..confusion about query

Sam Cosgrove 17 May 2019 15:20 question, complete

Hi, I'm trying to add multiple filters to some different low search forms.

I'll need to be able to adjust items per page, and more importantly, order by date and score. I think I am doing it correctly but whenever I submit one of these forms, it doesn't appear to pickup the actual query and just passes in the new filter param. So the keywords, categories, collection etc. from the search get lost.

Here's my filter code for the sorting, this might help:


{exp:low_search:form query="{segment_3}" result_page="search/results/"}
<div class="select-wrapper">
<select name="orderby_sort" onchange="this.form.submit()">
<option value="low_search_score|asc" {if low_search_orderby_sort == 'low_search_score|asc'} selected{/if}>Relevance Asc.</option>
<option value="low_search_score|desc" {if low_search_orderby_sort == 'low_search_score|desc'} selected{/if}>Relevance Desc.</option>
<option value="date|asc" {if low_search_orderby_sort == 'date|asc'} selected{/if}>Date Asc.</option>
<option value="date|desc" {if low_search_orderby_sort == 'date|desc'} selected{/if}>Date Desc.</option>
</select>
</div>
{/exp:low_search:form}

Replies

  1. Low 20 May 2019 06:27

    You could use the remember="" parameter to pass on other values, but in this case, I'd recommend using the URL-tag instead. Something like

    <a href="{exp:low_search:url query="{segment_3}" orderby_sort="date|desc"}">Date Desc.</a>

  2. Sam Cosgrove 21 May 2019 09:20

    Hi Low,

    That's fantastic thanks, that's really helped. Got stuck for a moment wondering why it still wasn't working even using those, but I've noticed that if there are default parameters on the results tag, i.e. limit, orderby_sort, they won't be overridden. I've removed them and it's working as intended now.