quick search - small fixes & improvements
available number of comments per user do not use visible_categories (only forbidden) git-svn-id: http://piwigo.org/svn/trunk@28579 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
bd73ad9679
commit
8b4857c773
2 changed files with 19 additions and 16 deletions
|
|
@ -1368,7 +1368,7 @@ function get_filter_page_value($value_name)
|
|||
{
|
||||
return $conf['filter_pages'][$page_name][$value_name];
|
||||
}
|
||||
else if (isset($conf['filter_pages']['default'][$value_name]))
|
||||
elseif (isset($conf['filter_pages']['default'][$value_name]))
|
||||
{
|
||||
return $conf['filter_pages']['default'][$value_name];
|
||||
}
|
||||
|
|
@ -1994,8 +1994,7 @@ function get_nb_available_comments()
|
|||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'ic.image_id'
|
||||
'forbidden_images' => 'ic.image_id'
|
||||
),
|
||||
'', true
|
||||
);
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ function qsearch_get_text_token_search_sql($token, $fields)
|
|||
if ($use_ft)
|
||||
{
|
||||
$max = max( array_map( 'mb_strlen',
|
||||
preg_split('/['.preg_quote('!"#$%&()*+,./:;<=>?@[\]^`{|}~','/').']+/', $variant, PREG_SPLIT_NO_EMPTY)
|
||||
preg_split('/['.preg_quote('-\'!"#$%&()*+,./:;<=>?@[\]^`{|}~','/').']+/', $variant)
|
||||
) );
|
||||
if ($max<4)
|
||||
$use_ft = false;
|
||||
|
|
@ -966,7 +966,7 @@ WHERE ('. implode("\n OR ",$clauses) .')';
|
|||
// check adjacent short words
|
||||
for ($i=0; $i<count($expr->stokens)-1; $i++)
|
||||
{
|
||||
if ( (strlen($expr->stokens[$i])<=3 || strlen($expr->stokens[$i+1])<=3)
|
||||
if ( (strlen($expr->stokens[$i]->term)<=3 || strlen($expr->stokens[$i+1]->term)<=3)
|
||||
&& (($expr->stoken_modifiers[$i] & (QST_QUOTED|QST_WILDCARD)) == 0)
|
||||
&& (($expr->stoken_modifiers[$i+1] & (QST_BREAK|QST_QUOTED|QST_WILDCARD)) == 0) )
|
||||
{
|
||||
|
|
@ -995,11 +995,16 @@ SELECT image_id FROM '.IMAGE_TAG_TABLE.'
|
|||
if ($expr->stoken_modifiers[$i]&QST_NOT)
|
||||
$not_ids = array_merge($not_ids, $tag_ids);
|
||||
else
|
||||
$positive_ids = array_merge($positive_ids, $tag_ids);
|
||||
{
|
||||
if (strlen($token->term)>2 || count($expr->stokens)==1 || isset($token->scope) || ($token->modifier&(QST_WILDCARD|QST_QUOTED)) )
|
||||
{// add tag ids to list only if the word is not too short (such as de / la /les ...)
|
||||
$positive_ids = array_merge($positive_ids, $tag_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($token->scope) && 'tag' == $token->scope->id && strlen($token->term)==0)
|
||||
{
|
||||
if ($tokens[$i]->modifier & QST_WILDCARD)
|
||||
if ($token->modifier & QST_WILDCARD)
|
||||
{// eg. 'tag:*' returns all tagged images
|
||||
$qsr->tag_iids[$i] = query2array('SELECT DISTINCT image_id FROM '.IMAGE_TAG_TABLE, null, 'image_id');
|
||||
}
|
||||
|
|
@ -1221,8 +1226,7 @@ function get_quick_search_results_no_cache($q, $options)
|
|||
array
|
||||
(
|
||||
'forbidden_categories' => 'category_id',
|
||||
'visible_categories' => 'category_id',
|
||||
'visible_images' => 'i.id'
|
||||
'forbidden_images' => 'i.id'
|
||||
),
|
||||
null,true
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue