Merge pull request #965 from stig/size-range-fix

mu: swap begin and end if begin is _numerically_ bigger than end
This commit is contained in:
Dirk-Jan C. Binnema 2016-12-04 18:04:29 +02:00 committed by GitHub
commit 0c98e91b5b
2 changed files with 4 additions and 3 deletions

View File

@ -115,13 +115,13 @@ public:
if (!substitute_size (begin) || !substitute_size (end))
return Xapian::BAD_VALUENO;
begin = Xapian::sortable_serialise (atol(begin.c_str()));
end = Xapian::sortable_serialise (atol(end.c_str()));
/* swap if b > e */
if (begin > end)
std::swap (begin, end);
begin = Xapian::sortable_serialise (atol(begin.c_str()));
end = Xapian::sortable_serialise (atol(end.c_str()));
return (Xapian::valueno)MU_MSG_FIELD_ID_SIZE;
}
private:

View File

@ -507,6 +507,7 @@ test_mu_query_sizes (void)
int i;
QResults queries[] = {
{ "size:0b..2m", 19},
{ "size:3b..2m", 19},
{ "size:2k..4k", 4},
{ "size:2m..0b", 19}
};