Changeset 28092


Ignore:
Timestamp:
04/06/14 08:33:46 (5 years ago)
Author:
rvelices
Message:

bug 3056: quick search - added events for plugins; completed help file

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_search.inc.php

    r28090 r28092  
    868868        $clauses[] = $file_like; 
    869869 
    870         if ($inflector!=null && strlen($term)>2 
     870        $variants = array(); 
     871        if (strlen($term)>2 
    871872          && ($expr->stoken_modifiers[$i] & (QST_QUOTED|QST_WILDCARD))==0 
    872           && strcspn($term, '\'0123456789') == strlen($term) 
    873           ) 
    874         { 
    875           $variants = array_unique( array_diff( $inflector->get_variants($term), array($term) ) ); 
     873          && strcspn($term, '\'0123456789') == strlen($term) ) 
     874        { 
     875          if ($inflector!=null) 
     876            $variants = array_unique( array_diff( $inflector->get_variants($term), array($term) ) ); 
     877          $variants = trigger_event('qsearch_get_variants', $variants, $token, $expr); 
     878          $variants = array_unique( array_diff( $variants, array($term) ) ); 
    876879          $qsr->variants[$term] = $variants; 
    877         } 
    878         else 
    879         { 
    880           $variants = array(); 
    881880        } 
    882881 
     
    931930        $clauses[] = $token->scope->get_sql('date_available', $token); 
    932931        break; 
    933  
     932      default: 
     933        // allow plugins to have their own scope with columns added in db by themselves 
     934        $clauses = trigger_event('qsearch_get_images_sql_scopes', $clauses, $token, $expr); 
     935        break; 
    934936    } 
    935937    if (!empty($clauses)) 
     
    12171219  $scopes[] = new QNumericRangeScope('score', array('rating'), true); 
    12181220 
    1219   $createdDateAliases = array('taken'); 
     1221  $createdDateAliases = array('taken', 'shot'); 
    12201222  $postedDateAliases = array('added'); 
    12211223  if ($conf['calendar_datefield'] == 'date_creation') 
     
    12261228  $scopes[] = new QDateRangeScope('posted', $postedDateAliases); 
    12271229 
     1230  // allow plugins to add their own scopes 
     1231  $scopes = trigger_event('qsearch_get_scopes', $scopes); 
    12281232  $expression = new QExpression($q, $scopes); 
     1233  trigger_action('qsearch_expression_parsed', $expression); 
    12291234//var_export($expression); 
    12301235 
     1236  if (count($expression->stokens)==0) 
     1237  { 
     1238    return $search_results; 
     1239  } 
    12311240  $qsr = new QResults; 
    12321241  qsearch_get_tags($expression, $qsr); 
    12331242  qsearch_get_images($expression, $qsr); 
    1234 //var_export($qsr->all_tags); 
     1243 
     1244  // allow plugins to evaluate their own scopes 
     1245  trigger_action('qsearch_before_eval', $expression, $qsr); 
    12351246 
    12361247  $ids = qsearch_eval($expression, $qsr, $tmp, $search_results['qs']['unmatched_terms']); 
  • trunk/language/en_UK/help/quick_search.html

    r28087 r28092  
    3535<q>OR search</q><br> 
    3636</td> 
    37 <td>Add a OR between words.<br> 
     37<td>Add an OR between words.<br> 
    3838<q>john OR bill</q></td> 
    3939</tr> 
     
    6464 
    6565<tr> 
    66 <td><q>tag:</q> 
     66<td><q>tag:</q><br> 
     67<q>tags:</q> 
    6768</td> 
    6869<td>Searches only in tag names without looking at photo titles or descriptions.<br> 
     
    7172 
    7273<tr> 
    73 <td><q>photo:</q> 
     74<td><q>photo:</q><br> 
     75<q>photos:</q> 
    7476</td> 
    75 <td></td> 
     77<td>Searches only for photos with the given words in title or description.<br> 
     78<q>photo:John</q></td> 
    7679</tr> 
    7780 
     
    7982<td><q>file:</q> 
    8083</td> 
    81 <td>Searches by file name.</td> 
     84<td>Searches by file name.<br> 
     85<q>file:DSC_</q></td> 
    8286</tr> 
    8387 
     
    8589<td><q>created:</q><br> 
    8690<q>taken:</q> 
     91<q>shot:</q> 
    8792</td> 
    88 <td>Searches photos by taken date<br> 
     93<td>Searches photos by taken date.<br> 
    8994<q>taken:2003</q> photos taken in 2003<br> 
    9095<q>taken:20035</q>,<q>taken:2003-5</q>,<q>taken:2003-05</q> photos from may 2003<br> 
     
    97102<td><q>posted:</q> 
    98103</td> 
    99 <td></td> 
     104<td>Searches photos by posted date.</td> 
    100105</tr> 
    101106 
     
    104109<q>height:</q> 
    105110</td> 
    106 <td></td> 
     111<td>Searches photos with a given width or height.</td> 
    107112</tr> 
    108113<tr> 
    109114<td><q>size:</q> 
    110115</td> 
    111 <td></td> 
     116<td>Searches photos by size in pixels<br> 
     117<q>size:5m</q> returns photos of 5 megapixels<br> 
     118<q>size:>12m</q> returns photos of 12 megapixels or more<br></td> 
    112119</tr> 
    113120<tr> 
    114121<td><q>ratio:</q> 
    115122</td> 
    116 <td></td> 
     123<td>Searches photos by width/height ratio.<br> 
     124<q>ratio:3/4 OR ratio:4/3</q> finds photos from compact cameras in portrait or landscape modes 
     125<q>ratio:>16/9</q> finds panoramas 
     126</td> 
    117127</tr> 
    118128<tr> 
     
    122132</tr> 
    123133<tr> 
    124 <td><q>score:</q> 
     134<td><q>score:</q><br> 
     135<q>rating:</q> 
    125136</td> 
    126 <td></td> 
     137<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> 
     138</tr> 
     139<tr> 
     140<td><q>filesize:</q> 
     141</td> 
     142<td>Searches photos by file size<br> 
     143<q>filesize:1m..10m</q> finds files between 1MB and 10MB.</td> 
    127144</tr> 
    128145 
Note: See TracChangeset for help on using the changeset viewer.