Wildcat characters on search. Do we have them? Wildcat characters on search. Do we have them?
 

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]

Main Menu

Wildcat characters on search. Do we have them?

Started by mr5, December 21, 2011, 03:12:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mr5

Hi, sorry for so basic question, but I didn't find the answer after seraching all docs and forum...
Can we use wild characters * or ? on search? Documentation mentions them only when searching for a user, but not in a general album search. Could it be that wildcat characters are not supported at search???  For example, '?' does not work for "any character".
Thanks

Αndré

Wildcard '?' isn't supported out of the box, but '*' is.

If you want to use '?' as wildcard, open include/search.inc.php, find
$search_string = strtr($search_string, array('_' => '\_', '%' => '\%', '*' => '%'));
and replace with
$search_string = strtr($search_string, array('_' => '\_', '%' => '\%', '*' => '%', '?' => '_'));

mr5

Thanks a lot Andre! The change works OK. I would suggest to make it permanent as it helps a lot, specially when searching on text with special national characters.
I see that '*' includes string with blanks, that is will find a string with blanks inside. This is news to me, but it probably should work this way. You can close this. Thanks.

Αndré

Please
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.