Filter by hr/week and month
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
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
Low 4 May 2015 15:53
I'm not sure what you mean. Can you elaborate?
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
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
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.
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.
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
Low 13 May 2015 13:11
What's your LS version?
lincolnpixel 13 May 2015 13:47
Hi Low,
I'm on EEv2.9.2 and LS 4.2.0
Thanks
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?
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
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?
lincolnpixel 13 May 2015 14:48
Hi Low,
you mean this http://pastie.org/10186832 ?
Thanks
Low 13 May 2015 15:33
Drop me an email at hi at gotolow dot com so I can send you a patched file.
lincolnpixel 13 May 2015 21:53
Hi Low,
Thanks! got it working with the patched file.
Thanks
Low 14 May 2015 08:09
Cool. I'll include the fix in the next version.