mu: swap begin and end if begin is _numerically_ bigger than end
The old behaviour would compare the strings, so would swap the start and end ranges if start was 3K and end was 2M. Fixes: 964
This commit is contained in:
@ -115,13 +115,13 @@ public:
|
|||||||
if (!substitute_size (begin) || !substitute_size (end))
|
if (!substitute_size (begin) || !substitute_size (end))
|
||||||
return Xapian::BAD_VALUENO;
|
return Xapian::BAD_VALUENO;
|
||||||
|
|
||||||
|
begin = Xapian::sortable_serialise (atol(begin.c_str()));
|
||||||
|
end = Xapian::sortable_serialise (atol(end.c_str()));
|
||||||
|
|
||||||
/* swap if b > e */
|
/* swap if b > e */
|
||||||
if (begin > end)
|
if (begin > end)
|
||||||
std::swap (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;
|
return (Xapian::valueno)MU_MSG_FIELD_ID_SIZE;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -507,6 +507,7 @@ test_mu_query_sizes (void)
|
|||||||
int i;
|
int i;
|
||||||
QResults queries[] = {
|
QResults queries[] = {
|
||||||
{ "size:0b..2m", 19},
|
{ "size:0b..2m", 19},
|
||||||
|
{ "size:3b..2m", 19},
|
||||||
{ "size:2k..4k", 4},
|
{ "size:2k..4k", 4},
|
||||||
{ "size:2m..0b", 19}
|
{ "size:2m..0b", 19}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user