Keyword overlapping Keyword overlapping
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Keyword overlapping

Started by amiyuy, June 03, 2006, 12:32:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

amiyuy

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~

Paver

#1
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:
$keyword = "OR (keywords like '%$CURRENT_ALBUM_KEYWORD%' $forbidden_set_string )";
$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:
$keyword = "OR (keywords like '%$album_keyword%' $forbidden_set_string )";
with such a line:
$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.

amiyuy

Thank you soooo much for this!  I finally implemented it and it worked perfectly.  ^^