diff --git a/lib/mu-query.cc b/lib/mu-query.cc index 5bdb1024..969d4be9 100644 --- a/lib/mu-query.cc +++ b/lib/mu-query.cc @@ -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); }