Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Keyword overlapping  (Read 4988 times)

0 Members and 1 Guest are viewing this topic.

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Keyword overlapping
« 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~
« Last Edit: June 26, 2006, 07:22:50 am by Paver »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Keyword overlapping
« Reply #1 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.
« Last Edit: June 03, 2006, 07:12:59 pm by Paver »
Logged

amiyuy

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 9
    • K.Y.O. Cosplay gallery
Re: Keyword overlapping
« Reply #2 on: June 26, 2006, 07:07:08 am »

Thank you soooo much for this!  I finally implemented it and it worked perfectly.  ^^
Logged
Pages: [1]   Go Up
 

Page created in 0.034 seconds with 19 queries.