mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 04:09:56 +03:00
fixes #1221 optionnaly include photos from sub-albums of an album matching the search request.
* use configuration setting quick_search_include_sub_albums (default=false) to activate this feature. * the list of sub-albums is not displayed in the list of album results (to avoid too long lists).
This commit is contained in:
parent
d343959372
commit
1be34f33a4
2 changed files with 19 additions and 1 deletions
|
@ -850,6 +850,12 @@ $conf['batch_manager_images_per_page_unit'] = 5;
|
||||||
// how many missing md5sum should Piwigo compute at once.
|
// how many missing md5sum should Piwigo compute at once.
|
||||||
$conf['checksum_compute_blocksize'] = 50;
|
$conf['checksum_compute_blocksize'] = 50;
|
||||||
|
|
||||||
|
// quicksearch engine: include all photos from sub-albums of any matching
|
||||||
|
// album. For example, if search is "bear", then we display photos from
|
||||||
|
// "bear/grizzly". When value changed, delete database cache files in
|
||||||
|
// _data/cache directory
|
||||||
|
$conf['quick_search_include_sub_albums'] = false;
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
// | log |
|
// | log |
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
|
@ -1119,7 +1119,7 @@ SELECT image_id FROM '.IMAGE_TAG_TABLE.'
|
||||||
|
|
||||||
function qsearch_get_categories(QExpression $expr, QResults $qsr)
|
function qsearch_get_categories(QExpression $expr, QResults $qsr)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user, $conf;
|
||||||
|
|
||||||
$token_cat_ids = $qsr->cat_iids = array_fill(0, count($expr->stokens), array() );
|
$token_cat_ids = $qsr->cat_iids = array_fill(0, count($expr->stokens), array() );
|
||||||
$all_cats = array();
|
$all_cats = array();
|
||||||
|
@ -1171,6 +1171,18 @@ SELECT
|
||||||
|
|
||||||
if (!empty($cat_ids))
|
if (!empty($cat_ids))
|
||||||
{
|
{
|
||||||
|
if ($conf['quick_search_include_sub_albums'])
|
||||||
|
{
|
||||||
|
$query = '
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM '.CATEGORIES_TABLE.'
|
||||||
|
INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ON id = cat_id and user_id = '.$user['id'].'
|
||||||
|
WHERE id IN ('.implode(',', get_subcat_ids($cat_ids)) .')
|
||||||
|
;';
|
||||||
|
$cat_ids = query2array($query, null, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
$query = '
|
$query = '
|
||||||
SELECT image_id FROM '.IMAGE_CATEGORY_TABLE.'
|
SELECT image_id FROM '.IMAGE_CATEGORY_TABLE.'
|
||||||
WHERE category_id IN ('.implode(',',$cat_ids).')
|
WHERE category_id IN ('.implode(',',$cat_ids).')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue