How to show album in search instead the thumbnails by keywords How to show album in search instead the thumbnails by keywords
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

How to show album in search instead the thumbnails by keywords

Started by user454, July 16, 2013, 05:06:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

user454

Hello.
I use latest version of coppermine.

With plugin KEYWORD_ADD i assign keywords to my albums. When i search keyword it show me all pictures in all albums with this keyword.
What i should edit to see albums by keywords together or instead of images.

For example: i added keyword HELLO in all pictures in 2 album. Now when i search HELLO - i get bunch of pictures from 2 albums. Instead of this i want to get this 2 albums.

How can i make this?

user454

Hello!
Just find in include/search.inc.php this:

$album_query = "SELECT aid, title, description FROM `{$CONFIG['TABLE_ALBUMS']}` AS p"
                        ." WHERE (`title` " . implode(" $type `title` ",$albcat_terms) . ") $FORBIDDEN_SET";
$result = cpg_db_query($album_query);

and replace it by
$album_query = "SELECT `{$CONFIG['TABLE_PICTURES']}`.`aid`,`{$CONFIG['TABLE_ALBUMS']}`.`title`,`{$CONFIG['TABLE_ALBUMS']}`.`description` FROM `{$CONFIG['TABLE_PICTURES']}`,`{$CONFIG['TABLE_ALBUMS']}`  WHERE (`keywords` " . implode(" $type `title` ",$albcat_terms) . ") AND `{$CONFIG['TABLE_PICTURES']}`.`aid`=`{$CONFIG['TABLE_ALBUMS']}`.`aid` $FORBIDDEN_SET GROUP BY `{$CONFIG['TABLE_PICTURES']}`.`aid`";
$result = cpg_db_query($album_query );


Work perfectly for me

user454

Small correction:
$album_query = "SELECT `{$CONFIG['TABLE_PICTURES']}`.`aid`,`{$CONFIG['TABLE_ALBUMS']}`.`title`,`{$CONFIG['TABLE_ALBUMS']}`.`description` FROM `{$CONFIG['TABLE_PICTURES']}`,`{$CONFIG['TABLE_ALBUMS']}`  WHERE (`keywords` " . implode(" $type `keywords` ",$albcat_terms) . ") AND `{$CONFIG['TABLE_PICTURES']}`.`aid`=`{$CONFIG['TABLE_ALBUMS']}`.`aid` $FORBIDDEN_SET GROUP BY `{$CONFIG['TABLE_PICTURES']}`.`aid`";
$result = cpg_db_query($album_query );

ΑndrĂ©