diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_search.inc.php | 33 | ||||
-rw-r--r-- | language/en_UK/help/quick_search.html | 41 |
2 files changed, 51 insertions, 23 deletions
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 { <td>either term<br> <q>OR search</q><br> </td> -<td>Add a OR between words.<br> +<td>Add an OR between words.<br> <q>john OR bill</q></td> </tr> @@ -63,29 +63,34 @@ TD { <table style="border-collapse:collapse;text-align:left"> <tr> -<td><q>tag:</q> +<td><q>tag:</q><br> +<q>tags:</q> </td> <td>Searches only in tag names without looking at photo titles or descriptions.<br> <q>tag:john</q>, <q>tag:(john OR bill)</q></td> </tr> <tr> -<td><q>photo:</q> +<td><q>photo:</q><br> +<q>photos:</q> </td> -<td></td> +<td>Searches only for photos with the given words in title or description.<br> +<q>photo:John</q></td> </tr> <tr> <td><q>file:</q> </td> -<td>Searches by file name.</td> +<td>Searches by file name.<br> +<q>file:DSC_</q></td> </tr> <tr> <td><q>created:</q><br> <q>taken:</q> +<q>shot:</q> </td> -<td>Searches photos by taken date<br> +<td>Searches photos by taken date.<br> <q>taken:2003</q> photos taken in 2003<br> <q>taken:20035</q>,<q>taken:2003-5</q>,<q>taken:2003-05</q> photos from may 2003<br> <q>taken:2003..2008</q> photos from 2003 to 2008<br> @@ -96,24 +101,29 @@ TD { <tr> <td><q>posted:</q> </td> -<td></td> +<td>Searches photos by posted date.</td> </tr> <tr> <td><q>width:</q><br> <q>height:</q> </td> -<td></td> +<td>Searches photos with a given width or height.</td> </tr> <tr> <td><q>size:</q> </td> -<td></td> +<td>Searches photos by size in pixels<br> +<q>size:5m</q> returns photos of 5 megapixels<br> +<q>size:>12m</q> returns photos of 12 megapixels or more<br></td> </tr> <tr> <td><q>ratio:</q> </td> -<td></td> +<td>Searches photos by width/height ratio.<br> +<q>ratio:3/4 OR ratio:4/3</q> finds photos from compact cameras in portrait or landscape modes +<q>ratio:>16/9</q> finds panoramas +</td> </tr> <tr> <td><q>hits:</q> @@ -121,9 +131,16 @@ TD { <td></td> </tr> <tr> -<td><q>score:</q> +<td><q>score:</q><br> +<q>rating:</q> </td> -<td></td> +<td>Hint: <q>score:*</q> will give you all photos with at least one vote. <q>score:</q> will give you photos without votes.</td> +</tr> +<tr> +<td><q>filesize:</q> +</td> +<td>Searches photos by file size<br> +<q>filesize:1m..10m</q> finds files between 1MB and 10MB.</td> </tr> </table>
\ No newline at end of file |