Changeset 28579


Ignore:
Timestamp:
May 31, 2014, 8:50:30 PM (10 years ago)
Author:
rvelices
Message:

quick search - small fixes & improvements
available number of comments per user do not use visible_categories (only forbidden)

Location:
trunk/include
Files:
2 edited

Legend:

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

    r28567 r28579  
    11771177    $dbValue = $value;
    11781178  }
    1179  
     1179
    11801180  $query = '
    11811181INSERT INTO
     
    11841184  ON DUPLICATE KEY UPDATE value = \''.$dbValue.'\'
    11851185;';
    1186  
     1186
    11871187  pwg_query($query);
    1188  
     1188
    11891189  if ($updateGlobal)
    11901190  {
     
    13691369    return $conf['filter_pages'][$page_name][$value_name];
    13701370  }
    1371   else if (isset($conf['filter_pages']['default'][$value_name]))
     1371  elseif (isset($conf['filter_pages']['default'][$value_name]))
    13721372  {
    13731373    return $conf['filter_pages']['default'][$value_name];
     
    19951995          (
    19961996            'forbidden_categories' => 'category_id',
    1997             'visible_categories' => 'category_id',
    1998             'visible_images' => 'ic.image_id'
     1997            'forbidden_images' => 'ic.image_id'
    19991998          ),
    20001999        '', true
  • trunk/include/functions_search.inc.php

    r28459 r28579  
    607607              break;
    608608            }
    609             if (strlen($crt_token) && preg_match('/[0-9]/', substr($crt_token,-1)) 
     609            if (strlen($crt_token) && preg_match('/[0-9]/', substr($crt_token,-1))
    610610              && $qi+1<strlen($q) && preg_match('/[0-9]/', $q[$qi+1]))
    611611            {// dot between digits is not a separator e.g. F2.8
     
    708708
    709709  /**
    710   * Applies recursively a search scope to all sub single tokens. We allow 'tag:(John Bill)' but we cannot evaluate 
     710  * Applies recursively a search scope to all sub single tokens. We allow 'tag:(John Bill)' but we cannot evaluate
    711711  * scopes on expressions so we rewrite as '(tag:John tag:Bill)'
    712712  */
     
    844844    if ($use_ft)
    845845    {
    846       $max = max( array_map( 'mb_strlen', 
    847         preg_split('/['.preg_quote('!"#$%&()*+,./:;<=>?@[\]^`{|}~','/').']+/', $variant, PREG_SPLIT_NO_EMPTY)
     846      $max = max( array_map( 'mb_strlen',
     847        preg_split('/['.preg_quote('-\'!"#$%&()*+,./:;<=>?@[\]^`{|}~','/').']+/', $variant)
    848848        ) );
    849849      if ($max<4)
     
    967967  for ($i=0; $i<count($expr->stokens)-1; $i++)
    968968  {
    969     if ( (strlen($expr->stokens[$i])<=3 || strlen($expr->stokens[$i+1])<=3)
     969    if ( (strlen($expr->stokens[$i]->term)<=3 || strlen($expr->stokens[$i+1]->term)<=3)
    970970      && (($expr->stoken_modifiers[$i] & (QST_QUOTED|QST_WILDCARD)) == 0)
    971971      && (($expr->stoken_modifiers[$i+1] & (QST_BREAK|QST_QUOTED|QST_WILDCARD)) == 0) )
     
    996996        $not_ids = array_merge($not_ids, $tag_ids);
    997997      else
    998         $positive_ids = array_merge($positive_ids, $tag_ids);
     998      {
     999        if (strlen($token->term)>2 || count($expr->stokens)==1 || isset($token->scope) || ($token->modifier&(QST_WILDCARD|QST_QUOTED)) )
     1000        {// add tag ids to list only if the word is not too short (such as de / la /les ...)
     1001          $positive_ids = array_merge($positive_ids, $tag_ids);
     1002        }
     1003      }
    9991004    }
    10001005    elseif (isset($token->scope) && 'tag' == $token->scope->id && strlen($token->term)==0)
    10011006    {
    1002       if ($tokens[$i]->modifier & QST_WILDCARD)
     1007      if ($token->modifier & QST_WILDCARD)
    10031008      {// eg. 'tag:*' returns all tagged images
    10041009        $qsr->tag_iids[$i] = query2array('SELECT DISTINCT image_id FROM '.IMAGE_TAG_TABLE, null, 'image_id');
     
    10961101    strtolower($q),
    10971102    $conf['order_by'],
    1098     $user['id'],$user['cache_update_time'], 
     1103    $user['id'],$user['cache_update_time'],
    10991104    isset($options['permissions']) ? (boolean)$options['permissions'] : true,
    11001105    isset($options['images_where']) ? $options['images_where'] : '',
     
    12221227          (
    12231228            'forbidden_categories' => 'category_id',
    1224             'visible_categories' => 'category_id',
    1225             'visible_images' => 'i.id'
     1229            'forbidden_images' => 'i.id'
    12261230          ),
    12271231        null,true
Note: See TracChangeset for help on using the changeset viewer.