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

Support archive

Low Search - Adding a second orderby parameter

Jordan Sowers 13 Feb 2014 09:55 question, complete

Hello,

I'm currently using Low Search and loving it. Except I got to a point where I want to order search results. I have a site with premium accounts. Natively expression engine will let you do orderby="account_score|price" sort="asc". What usually with normal channel entries tags is that you get the buckets of the different accounts ordered first, THEN in each bucket you get the orderby price...

There's a similar thread here, but for a different module: https://getsatisfaction.com/low/topic...

What i'm finding is that low search isn't working in this way. I've tried doing orderby as an input and as a parameter in the results tag. Any ideas? Am I overlooking something?

Replies

  1. Jordan Sowers 13 Feb 2014 10:11

    Holy shit. Just got it.

    Alright. I'll leave this for those who might have the same question.

    Answer: sort="asc|desc"

    Asc is for the first orderby option, desc is for the second.

  2. Low 13 Feb 2014 10:13

    Hmm, that should work just fine. What are your EE, LS and PHP versions? Also, what's your Form and Results tag code? You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.

  3. Jordan Sowers 13 Feb 2014 10:24

    Wow. That was quick!

    Hers's my versions:
    ExpressionEngine v2.7.3
    LS: 3.0.4
    PHP Version 5.3.10-1ubuntu3.9

    Heres my code. Both tags are on the same page. Let me know if there is another solution or something i'm missing. Thanks for your time!

    http://pastie.org/8729226

  4. Low 13 Feb 2014 11:06

    Cool, so you got it working?

    One thing I should mention that ordering by low_search_score as a secondary sort will not work, I'm afraid. Either you can sort only by score, or by other fields, which can be multiple.

  5. Jordan Sowers 13 Feb 2014 21:47

    Yep, things seem to be working. I was curious about the low_search_score, but haven't got that far. I should be okay sorting things by date & price.

    Thanks for the help! I must say, that i'm going to write a review on Devot-ee. I was using super search and there were a LOT of hacks to get it working properly with orderby select-drop downs. The thing that I was most stoked about with low:search is that its 20mb of PHP memory LESS than super search for each page load. Both of the tests were using each module out of the box. Super search was pushing around 50-60mb of memory on some page queries :/

  6. Low 14 Feb 2014 07:23

    Good to hear! And I'd appreciate a review on devot:ee. :)