forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: amiyuy on June 03, 2006, 12:32:44 pm

Title: Keyword overlapping
Post by: amiyuy on June 03, 2006, 12:32:44 pm
Okay, I'm slowly figuring out all of the little parts of Coppermine and a problem that appeared today was this...

When one keyword has the same root as another, the images that have the root keyword then appear in the album that has the other keyword.

Here, example:
- One album and it's images have the keyword "orihime"
- The second album and it's images have the keyword "orihimesscasual"

The images with the keyword "orihimesscasual" are being linked & displaying in the album that has "orihime" as the keyword as well as their normal album.

Is there someway to avoid this other than add more specification to the first keyword?

This is a problem that my gallery will run into a lot if it's not fixed, so any help would be appreciated.
~Ami~
Title: Re: Keyword overlapping
Post by: Paver on June 03, 2006, 06:15:03 pm
This doesn't really have to be "fixed", but rather "implemented".  It's just as if you searched for the smaller word, the larger one would come up as well.

Without modifying the core scripts, you could put starting & ending tags on your keywords, like so: "[apple]".

Or modify include/functions.inc.php in the following two lines.  Remove the % signs from the following two lines:
Code: [Select]
$keyword = "OR (keywords like '%$CURRENT_ALBUM_KEYWORD%' $forbidden_set_string )";
Code: [Select]
$keyword = "OR (keywords like '%$album_keyword%' $forbidden_set_string )";
And I think that should do it.

edit: On second thought, that will only work if you only have one keyword per photo.  Instead, replace each of the two lines as follows.  Replace such a line:
Code: [Select]
$keyword = "OR (keywords like '%$album_keyword%' $forbidden_set_string )";with such a line:
Code: [Select]
$keyword = "OR ((keywords like '$album_keyword %' OR keywords like '% $album_keyword' OR keywords like '% $album_keyword %') $forbidden_set_string )";
Note the use of spaces.  You add in a space between the % sign and the variable, and there are two other possibilities where the keyword is the first or last in the photo's keyword list.
Title: Re: Keyword overlapping
Post by: amiyuy on June 26, 2006, 07:07:08 am
Thank you soooo much for this!  I finally implemented it and it worked perfectly.  ^^