Ignore:
Timestamp:
Apr 6, 2014, 8:33:46 AM (10 years ago)
Author:
rvelices
Message:

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

File:
1 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']);
Note: See TracChangeset for help on using the changeset viewer.