Searching range:entry_date
I have a previously working search for news on a site. I'm trying to add a date range search for an archive. However, using the range:entry_date parameter in the search appears to break it in the sense that it returns results outside my collection (which is 1 channel). I end up with more results in a 1 month range search than there are entries in the entire news channel.
Here's the relevant details:
Search form tag-
{exp:low_search:form
query="{segment_3}"
collection="news"
search_mode="all"
result_page="news/archive-search"
}
Select for date-
< select id="month-year" name="range:entry_date">
< option value="">Month / Year</ option>
< option value="2014-04-01 00:00|2014-04-30 23:59">April 2014</ option>
< option value="2014-03-01 00:00|2014-03-31 23:59">March 2014</ option>
< option value="2013-06-01 00:00|2013-06-30 23:59">June 2013</ option>
< option value="2013-05-01 00:00|2013-05-31 23:59">May 2013< /option>
</ select>
Search Parameters logged by Low Search-
http://cl.ly/image/2H1o1Y2C3t3I
edit - spaces in HTML so GS won't hide the tags.
Replies
Jacob Russell 22 Apr 2014 14:16
In theory it shouldn't matter for this problem, but the site in question is MSM.
Low 22 Apr 2014 14:17
Since Low Search 3, all filter-related parameters aren't valid on the Form tag. Instead, set them as input field in the Form tag, or add them to the Results tag. In your case, the collection and search_mode parameters.
Jacob Russell 22 Apr 2014 14:19
Perfect, that fixed the issue. Updated for the entry date range and didn't catch that change. Thanks for the help!
Low 22 Apr 2014 14:24
Also, regarding the ranges, it might be nicer or more practical to use this as the values for the options:
Those dates translate to 2013-06-01 00:00:00 and 2013-07-01 00:00:00 thanks to php's strtotime function, so effectively spanning the whole month. And it will save to a bunch of characters. :)