diff --git a/ext/index/main.php b/ext/index/main.php
index 0aadaf2b..4d41ed20 100644
--- a/ext/index/main.php
+++ b/ext/index/main.php
@@ -83,9 +83,11 @@
*
tags>=10 -- search for images with 10 or more tags
* tags<25 -- search for images with less than 25 tags
*
- * source=url, eg
+ * source=(URL, any, none) eg
*
* - source=http://example.com -- find all images with "http://example.com" in the source
+ *
- source=any -- find all images with a source
+ *
- source=none -- find all images without a source
*
* order=(id, width, height, filesize, filename)_(ASC, DESC), eg
*
* Pools
*
- * - pool=PoolID -- search for images in a pool by PoolID
+ *
- pool=(PoolID, any, none) -- search for images in a pool by PoolID.
*
- pool_by_name=PoolName -- search for images in a pool by PoolName. underscores are replaced with spaces
*
*
@@ -323,7 +325,13 @@ class Index extends Extension {
}
else if(preg_match("/^(source)[=|:]([a-zA-Z0-9]*)$/i", $event->term, $matches)) {
$source = strtolower($matches[2]);
- $event->add_querylet(new Querylet('images.source LIKE :src', array("src"=>"%$source%")));
+
+ if(preg_match("/^(any|none)$/", $source)){
+ $not = ($source == "any" ? "NOT" : "");
+ $event->add_querylet(new Querylet("images.source IS $not NULL"));
+ }else{
+ $event->add_querylet(new Querylet('images.source LIKE :src', array("src"=>"%$source%")));
+ }
}
else if(preg_match("/^posted([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9-]*)$/", $event->term, $matches)) {
$cmp = ltrim($matches[1], ":") ?: "=";
diff --git a/ext/pools/main.php b/ext/pools/main.php
index 8431a653..6bcd8760 100644
--- a/ext/pools/main.php
+++ b/ext/pools/main.php
@@ -295,9 +295,15 @@ class Pools extends Extension {
public function onSearchTermParse(SearchTermParseEvent $event) {
$matches = array();
- if(preg_match("/^pool[=|:]([0-9]+)$/", $event->term, $matches)) {
+ if(preg_match("/^pool[=|:]([0-9]+|any|none)$/", $event->term, $matches)) {
$poolID = $matches[1];
- $event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"));
+
+ if(preg_match("/^(any|none)$/", $poolID)){
+ $not = ($poolID == "none" ? "NOT" : "");
+ $event->add_querylet(new Querylet("images.id $not IN (SELECT DISTINCT image_id FROM pool_images)"));
+ }else{
+ $event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"));
+ }
}
else if(preg_match("/^pool_by_name[=|:](.*)$/", $event->term, $matches)) {
$poolTitle = str_replace("_", " ", $matches[1]);