fixes #2003 search in tags no longer overides global result.

* Piwigo only tries to match tags "within" the search by word block, before combining with other filters
This commit is contained in:
plegall
2023-09-25 17:10:24 +02:00
parent c5b5dd0b8a
commit 61492d092e
2 changed files with 76 additions and 62 deletions
+21 -12
View File
@@ -447,21 +447,30 @@ SELECT
$template->assign('ALBUMS_FOUND', $albums_found);
}
}
if (isset($page['search_details']['matching_tags']))
if (isset($page['search_details']['matching_tag_ids']))
{
$tags_found = array();
foreach ($page['search_details']['matching_tags'] as $tag)
{
$url = make_index_url(
array(
'tags' => array($tag)
)
);
$tags_found[] = sprintf('<a href="%s">%s</a>', $url, $tag['name']);
}
$tag_ids = $page['search_details']['matching_tag_ids'];
if (count($tags_found) > 0)
if (count($tag_ids) > 0)
{
$query = '
SELECT
*
FROM '.TAGS_TABLE.'
WHERE id IN ('.implode(',', $tag_ids).')
ORDER BY name
;';
$tags = query2array($query);
$tags_found = array();
foreach ($tags as $tag)
{
$url = make_index_url(
array(
'tags' => array($tag)
)
);
$tags_found[] = sprintf('<a href="%s">%s</a>', $url, $tag['name']);
}
$template->assign('TAGS_FOUND', $tags_found);
}
}