diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php index 85cfeee78..e9d04d09f 100644 --- a/include/functions_search.inc.php +++ b/include/functions_search.inc.php @@ -867,18 +867,17 @@ function qsearch_get_images(QExpression $expr, QResults $qsr) case 'photo': $clauses[] = $file_like; - if ($inflector!=null && strlen($term)>2 + $variants = array(); + if (strlen($term)>2 && ($expr->stoken_modifiers[$i] & (QST_QUOTED|QST_WILDCARD))==0 - && strcspn($term, '\'0123456789') == strlen($term) - ) + && strcspn($term, '\'0123456789') == strlen($term) ) { - $variants = array_unique( array_diff( $inflector->get_variants($term), array($term) ) ); + if ($inflector!=null) + $variants = array_unique( array_diff( $inflector->get_variants($term), array($term) ) ); + $variants = trigger_event('qsearch_get_variants', $variants, $token, $expr); + $variants = array_unique( array_diff( $variants, array($term) ) ); $qsr->variants[$term] = $variants; } - else - { - $variants = array(); - } if (strlen($term)>3) // default minimum full text index { @@ -930,7 +929,10 @@ function qsearch_get_images(QExpression $expr, QResults $qsr) case 'posted': $clauses[] = $token->scope->get_sql('date_available', $token); break; - + default: + // allow plugins to have their own scope with columns added in db by themselves + $clauses = trigger_event('qsearch_get_images_sql_scopes', $clauses, $token, $expr); + break; } if (!empty($clauses)) { @@ -1216,7 +1218,7 @@ function get_quick_search_results($q, $options) $scopes[] = new QNumericRangeScope('hits', array('hit', 'visit', 'visits')); $scopes[] = new QNumericRangeScope('score', array('rating'), true); - $createdDateAliases = array('taken'); + $createdDateAliases = array('taken', 'shot'); $postedDateAliases = array('added'); if ($conf['calendar_datefield'] == 'date_creation') $createdDateAliases[] = 'date'; @@ -1225,13 +1227,22 @@ function get_quick_search_results($q, $options) $scopes[] = new QDateRangeScope('created', $createdDateAliases, true); $scopes[] = new QDateRangeScope('posted', $postedDateAliases); + // allow plugins to add their own scopes + $scopes = trigger_event('qsearch_get_scopes', $scopes); $expression = new QExpression($q, $scopes); + trigger_action('qsearch_expression_parsed', $expression); //var_export($expression); + if (count($expression->stokens)==0) + { + return $search_results; + } $qsr = new QResults; qsearch_get_tags($expression, $qsr); qsearch_get_images($expression, $qsr); -//var_export($qsr->all_tags); + + // allow plugins to evaluate their own scopes + trigger_action('qsearch_before_eval', $expression, $qsr); $ids = qsearch_eval($expression, $qsr, $tmp, $search_results['qs']['unmatched_terms']); diff --git a/language/en_UK/help/quick_search.html b/language/en_UK/help/quick_search.html index 484b96625..283cb6a1e 100644 --- a/language/en_UK/help/quick_search.html +++ b/language/en_UK/help/quick_search.html @@ -34,7 +34,7 @@ TD {
OR search
john OR bill
tag:+ | tag: + tags: |
Searches only in tag names without looking at photo titles or descriptions.tag:john, tag:(john OR bill) |
|
photo:+ | photo: + photos: |
-+ | Searches only for photos with the given words in title or description. + photo:John |
file: |
-Searches by file name. | +Searches by file name. + file:DSC_ |
|
created: taken:+ shot: |
-Searches photos by taken date + | Searches photos by taken date.taken:2003photos taken in 2003 taken:20035, taken:2003-5, taken:2003-05photos from may 2003 taken:2003..2008photos from 2003 to 2008 @@ -96,24 +101,29 @@ TD { | |
posted: |
-+ | Searches photos by posted date. | |
width: height: |
-+ | Searches photos with a given width or height. | |
size: |
-+ | Searches photos by size in pixels + size:5mreturns photos of 5 megapixels + size:>12mreturns photos of 12 megapixels or more |
|
ratio: |
-+ | Searches photos by width/height ratio. + ratio:3/4 OR ratio:4/3finds photos from compact cameras in portrait or landscape modes + ratio:>16/9finds panoramas + |
|
hits:@@ -121,9 +131,16 @@ TD { | |||
score:+ | score: + rating: |
-+ | Hint: score:*will give you all photos with at least one vote. score:will give you photos without votes. |
+
filesize:+ |
+Searches photos by file size + filesize:1m..10mfinds files between 1MB and 10MB. |