* mu-query: better handle empty lhs/rhs in date intervals

This commit is contained in:
djcb 2013-06-03 22:29:50 +03:00
parent d6337b751e
commit 13efc74793
1 changed files with 10 additions and 4 deletions

View File

@ -64,10 +64,16 @@ private:
const char* str;
time_t t;
str = mu_date_interpret_s (s.c_str(), is_begin ? TRUE: FALSE);
str = mu_date_complete_s (str, is_begin ? TRUE: FALSE);
t = mu_date_str_to_time_t (str, TRUE /*local*/);
str = mu_date_time_t_to_str_s (t, FALSE /*UTC*/);
// note: if s is empty and not is_begin, xapian seems
// to repeat it.
if (s.empty() || g_str_has_suffix (s.c_str(), "..")) {
str = mu_date_complete_s ("", is_begin);
} else {
str = mu_date_interpret_s (s.c_str(), is_begin ? TRUE: FALSE);
str = mu_date_complete_s (str, is_begin ? TRUE: FALSE);
t = mu_date_str_to_time_t (str, TRUE /*local*/);
str = mu_date_time_t_to_str_s (t, FALSE /*UTC*/);
}
return s = std::string(str);
}