Opened 112 minutes ago
#853 new defect
SPAN query parameter can be mis-handled
| Reported by: | Darrin Smart | Owned by: | Olly Betts |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Omega | Version: | 2.0.0 |
| Severity: | normal | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Operating System: | All |
Description
We recently updated from 1.4.20 to 2.0.0 and have come across an issue with the SPAN term in Omega searches. Our search does not use START or END query parameters, just SPAN:
<select name="SPAN" id="daterange" onChange="form.submit()">
<option value="" $if{$eq{$cgi{SPAN},},selected}>Any time</option>
<option value="1" $if{$eq{$cgi{SPAN},1},selected}>Past Day</option>
<option value="7" $if{$eq{$cgi{SPAN},7},selected}>Past Week</option>
<option value="31" $if{$eq{$cgi{SPAN},31},selected}>Past Month</option>
<option value="365" $if{$eq{$cgi{SPAN},365},selected}>Past Year</option>
</select>
Searches would return results when "Any time" is selected but give zero results in other cases.
I suspect the issue might lie in xapian-omega/date.cc:
250 time_t end = time(NULL); 251 struct tm *t = localtime(&end); 252 y2 = t->tm_year + 1900; 253 m2 = t->tm_mon + 1; 254 d2 = t->tm_mday; 255 parse_date(date_end, &y2, &m2, &d2, false); 256 int then = ymd_to_days(y2, m2, d2) - days; 257 days_to_ymd(then, y1, m1, d1);
It looks like the call to parse_date() isn't meant to be here. Indeed removing it seemed to fix the problem for me.
Note:
See TracTickets
for help on using tickets.
