hopefully fix search by ID range, and related bits

This commit is contained in:
Shish 2011-02-22 15:03:16 +00:00
parent 34b19c7738
commit 66e6cdd0a1

View File

@ -199,19 +199,19 @@ class Index extends SimpleExtension {
$matches = array();
if(preg_match("/^size(<|>|<=|>=|=)(\d+)x(\d+)$/", $event->term, $matches)) {
$cmp = $matches[1];
$args = array(int_escape($matches[2]), int_escape($matches[3]));
$event->add_querylet(new Querylet("width $cmp ? AND height $cmp ?", $args));
$args = array("width"=>int_escape($matches[2]), "height"=>int_escape($matches[3]));
$event->add_querylet(new Querylet("width $cmp :width AND height $cmp :height", $args));
}
else if(preg_match("/^ratio(<|>|<=|>=|=)(\d+):(\d+)$/", $event->term, $matches)) {
$cmp = $matches[1];
$args = array(int_escape($matches[2]), int_escape($matches[3]));
$event->add_querylet(new Querylet("width / height $cmp ? / ?", $args));
$args = array("width"=>int_escape($matches[2]), "height"=>int_escape($matches[3]));
$event->add_querylet(new Querylet("width / height $cmp :width / :height", $args));
}
else if(preg_match("/^(filesize|id)(<|>|<=|>=|=)(\d+[kmg]?b?)$/i", $event->term, $matches)) {
$col = $matches[1];
$cmp = $matches[2];
$val = parse_shorthand_int($matches[3]);
$event->add_querylet(new Querylet("images.$col $cmp ?", array($val)));
$event->add_querylet(new Querylet("images.$col $cmp :val", array("val"=>$val)));
}
else if(preg_match("/^(hash|md5)=([0-9a-fA-F]*)$/i", $event->term, $matches)) {
$hash = strtolower($matches[2]);