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: Help Making Search Function More Specific  (Read 7014 times)

0 Members and 1 Guest are viewing this topic.

Chili

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Help Making Search Function More Specific
« on: June 23, 2006, 05:33:35 am »

Like the original poster in this thread http://forum.coppermine-gallery.net/index.php?topic=30310.msg140285#msg140285 I also shoot motorsports and title my photo's by the bike #, I also use the riders name as well.  I'd like to narrow the search down so if you do a search for #9 you get only #9 and not any number with the #9 in it.  I've tried the fix in the above linked thread numerous times and even acquired the amended file from that original poster since we are acquainted, yet all that edit does is make my search stop finding any results.  The only difference I can think of is I believe his is searching the caption of the metadata while mine is entered into the title bar in coppermine.

Any assistance is greatly appreciated.
« Last Edit: June 29, 2006, 07:01:09 pm by Nibbler »
Logged

Chili

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Help Making Search Function More Specific
« Reply #1 on: June 27, 2006, 12:28:28 pm »

Anyone have any ideas?
Logged

Nibbler

  • Guest
Re: Help Making Search Function More Specific
« Reply #2 on: June 27, 2006, 09:04:16 pm »

The way I described in that post is the way to do it. Apply the mod, enable debug mode, and post a link to your gallery for support.
Logged

Chili

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Help Making Search Function More Specific
« Reply #3 on: June 28, 2006, 01:54:31 am »

Mod applied, search no longer works at finding any results.  debug mode enabled, I'm hoping this is what has caused my gallery to all of the sudden stretch sideways to extremely wide width?  Gallery can be found at http://www.holeshotphotography.net/gallery
Logged

Nibbler

  • Guest
Re: Help Making Search Function More Specific
« Reply #4 on: June 28, 2006, 03:13:11 pm »

OK, I see why. Also make this change in search.inc.php

Code: [Select]
$split_search = explode(' ', $search_string);
change to

Code: [Select]
$split_search = array($search_string);
and to allow searching of characters like the #, modify

Code: [Select]
$search_string = preg_replace('/[^0-9a-z %]/i', '', $search_string);
so that it includes such characters.
Logged

Chili

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Help Making Search Function More Specific
« Reply #5 on: June 29, 2006, 12:32:44 am »

Ok I think I'm part way home!  Now if I search by the exact phrase I've entered in the title I get results, however if I'm looking for say #91 Colin Cyr and only use 91 as my search criteria I get nothing, same for #91 etc it needs to be the complete title to find the result.  Is it possible to have it find on partial search results but only with the full number?  ie if #91 Colin Cyr comes looking for his photo's and uses any of the following as search criteria: 91, #91, Colin Cyr, 91 Cyr.  The way it was prior to any mods was fine for partial searches for names just not numbers.  I hope I'm not expecting too much, and I hope I've somehow rambled enough to make what I'm after clear enough.  Thank you for giving this some time Nibbler, It is very much appreciated. 
Logged

Nibbler

  • Guest
Re: Help Making Search Function More Specific
« Reply #6 on: June 29, 2006, 01:08:05 am »

OK, reverse all mods and then change

Code: [Select]
if (in_array($param, $allowed))$fields[] = "$param LIKE '%$word%'";
to

Code: [Select]
if (in_array($param, $allowed))$fields[] = is_numeric($word) ? "$param RLIKE '[^0-9]{$word}[^0-9]'" : "$param LIKE '%$word%'";
Logged

Chili

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Help Making Search Function More Specific
« Reply #7 on: June 29, 2006, 05:01:46 am »

Works Beautifully, Many Thanks Nibbler!
Logged

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: Help Making Search Function More Specific
« Reply #8 on: March 21, 2011, 03:22:12 am »

Hey Folks

Does this still work for cpg 1.5.12? I tried the mods and simply got the "doesn't yield any results" result. From what I gather, the only mod needed should be the one posted above in Nibbler's final reply?
OK, reverse all mods and then change

Code: [Select]
if (in_array($param, $allowed))$fields[] = "$param LIKE '%$word%'";
to

Code: [Select]
if (in_array($param, $allowed))$fields[] = is_numeric($word) ? "$param RLIKE '[^0-9]{$word}[^0-9]'" : "$param LIKE '%$word%'";

Is that correct? I've removed the mods until I can find out an answer, but my site is at Skolai Images

Thank you.

Cheers

Carl
Logged

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: Help Making Search Function More Specific
« Reply #9 on: March 23, 2011, 10:47:21 pm »

Hey Folks,

I've finally switched things over to a live site, so the url for my gallery is http://www.skolaiimages.com/stock/

Would really like to have the option for 'search exact terms'. Currently, for example, a search for "Mount St. Elias" yields all named mountains in Wrangell - St. Elias National Park. Does this above mod still work in cpg1.5 or is there another way to achieve this?

Thank you.

Cheers

Carl
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.