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

Support archive

Filter by hr/week and month

lincolnpixel 4 May 2015 15:03 question, complete

Hi Low,

I've got a keyword search that searches in a collection.
I want the entries outputted in the results to be filtered in this way

Past Hour
Past 24 hours
1 Week
1 Month

Thanks

Replies

  1. Low 4 May 2015 15:53

    I'm not sure what you mean. Can you elaborate?

  2. lincolnpixel 4 May 2015 15:57

    Hi,
    on a search results page how can i filter/order the results by past hour/ past 24 hrs/ past week and past month.

    Thanks

  3. Low 4 May 2015 16:13

    Do you want to only show entries with an entry date that is a maximum of 1 hour / 24 hours / 1 week / 1 month old? Or do you want to group the search results by their age?

    The former you could do by setting the start_on / stop_before parameters: https://ellislab.com/expressionengine...

    The latter would be trickier -- you'd need to catch all results in something like Stash and iterate through them to group them by timeframe.

    This sounds like an implementation, which I can help you with for a fee: see my Implemention Aid service: http://gotolow.com/contact

  4. lincolnpixel 11 May 2015 17:44

    Hello Low,

    I have a standard results page /results/ which works fine when returning keywords results.

    The results page has {exp:low_search:filters} tag pair. If i click the filter it takes me back to the /results pages, which works but it returns all entries. (not limiting to the specific hard-coded urls)


    {exp:low_search:filters}
    {if count == 1}<ul class="no-bullet">{/if}
    <li><a href="/results?keywords={low_search_keywords}&range-from:entry_date=-1+hour">Past hour </a></li>
    <li><a href="/results?keywords={low_search_keywords}&range-from:entry_date=-1+day">Past 24 hours</a></li>
    <li><a href="/results?keywords={low_search_keywords}&range-from:entry_date=-1+week">1 week </a></li>
    <li><a href="/results?keywords={low_search_keywords}&range-from:entry_date=-1+month">1 month</a></li>
    {if count == total_results}</ul>{/if}
    {/exp:low_search:filters}


    So as an example how could i achieve this?

    Thanks.

  5. Low 11 May 2015 22:20

    Try using the URL tag inside the Filters tag, eg.

    {low_search:url range=from:entry_date="-1 hour"}

    Etc.

  6. lincolnpixel 13 May 2015 10:16

    Hello Low,

    The url created with {low_search:url range=from:entry_date="-1 hour"} seems ok, the issue is still on the results page returning the whole entries not respecting the range filter.

    The results page code is here: http://pastie.org/10186145

    Appreciate your time/effort on this.

    Thanks

  7. Low 13 May 2015 13:11

    What's your LS version?

  8. lincolnpixel 13 May 2015 13:47

    Hi Low,
    I'm on EEv2.9.2 and LS 4.2.0

    Thanks

  9. Low 13 May 2015 13:50

    You've got range=from:entry_date (note the = sign) rather than range-from:entry_date.

    You can also check the template debugger and look up lines that mention Low Search / low_search. What does that tell you?

  10. lincolnpixel 13 May 2015 14:17

    Hi Low,
    meanwhile i've updated to the latest LS 4.3.0, fixed the typo of the url tag.
    Template debugger and range filter tag: http://pastie.org/10186781

    Thanks

  11. Low 13 May 2015 14:40

    What about the queries in the Output Profiler? There should be a query that is generated by lsf.ranges.php (Low_search_filter_ranges). Can you see that? What does that look like?

  12. lincolnpixel 13 May 2015 14:48

    Hi Low,
    you mean this http://pastie.org/10186832 ?

    Thanks

  13. Low 13 May 2015 15:33

    Drop me an email at hi at gotolow dot com so I can send you a patched file.

  14. lincolnpixel 13 May 2015 21:53

    Hi Low,
    Thanks! got it working with the patched file.

    Thanks

  15. Low 14 May 2015 08:09

    Cool. I'll include the fix in the next version.