I'm using ZP 1.2.1 on a site for a printer. I'm creating dynamic albums to show the available fonts for printing. This works great except for font albums titled "serif" and "sans serif". If a user types in "serif" they get both serif and sans serif fonts.
In looking for ways to make ZP to search for exact matches of tags, I found on the Changelog page for this version a listing for "The return of 'partial match search of tags' ", but no information about what this means.
How do I get an exact match? Is it possible?
Finally, a supportive voice. Zenphoto 1.2.1 required exact matches for tags. But everyone objected, so they reverted to partial matches. This is what the change log means.
There is a sql statement generated in class-search.php in the tagserach function right at the front of the function. Currently it uses LIKE %% change it to =
Great, thanks a lot. I just wanted to ask this question
Ideally, it would be nice to be able to create a dynamic album using an exact search, but still allow partial matches for general searches. Probably a much more complicated code change, but might be a nice feature. Don't know what the answer is, but I appreciate you telling me what to look for in the code.
Sometimes tags aren't single words tho, for example, a name whether it be a two-word city name or even a person, which would sometimes mean multiple words in a tag. Or like in the above example "sans serif".. It would be nice to have a drop-down menu option that the average user could choose by the search box that would pick exact match or partial match.
sbillard: I should probably mention that I am fairly new to PHP. I can't find the exact code you mention above... closest is $sql .= 'nameLIKE "%'.$singlesearchstring.'%" OR ';
Is this the line I need to edit? I've tried several ways of changing LIKE to = and none work.
A little more help please and thank you.
Hmm.. judging from the tone of your post, I apologize if I offended you in some way, acrylian..
I was not trying to be "right" but I do have multiple word tags in my photos, which is why I was one of those people who wanted the partial search match. I didn't see the point in exact match tag, but kenholmes has shed light on that for me.
While I certainly appreciate the programming debate over whether to quote or not to quote, can someone please help me find the correct line in the code to change to disable the partial match search?
What sbillard offered earlier: "There is a sql statement generated in class-search.php in the tagserach function right at the front of the function. Currently it uses LIKE %% change it to =" doesn't seem to apply to the code I am looking at. That
I do find: $sql .= 'name' LIKE "%'.$singlesearchstring.'%" OR ';
But making similar changes to this line breaks the search.
A spirited debate has ensued over the use of quote marks in searches, which is commendable. But it steps right past the answer to my problem. Please see above post.
As I stated before, I am fairly new to PHP (but I ain't stupid), so please lend a hand... Please? I need to create dynamic albums for fonts. Tags include "Serif" and "Sans Serif". Because exact search don't work, sans serif items come up when searching for "serif".
SBillard gave a solution to the problem - see thread above - [b]but the code given doesn't exist anywhere in the install[/b]. So... anyone? Or do I switch to Gallery? Or should I just live with the problem and resolve myself that you get what you pay for with free open source software?
I think you got the right part of the code.
$sql .= 'name' LIKE "%'.$singlesearchstring.'%" OR ';
(in the svn: $sql .= 'nameLIKE "%'.mysql_real_escape_string($singlesearchstring).'%" OR ';)
should work if changed to
$sql .= 'name' = "'.$singlesearchstring.'" OR ';
Bless you. This works fine, although it includes the album (not the images) for my "sans serif" fonts as an item when when searching for "serif". Hope that makes sense. This isn't as big an issue as the partial search problem, but it would be nice if it wasn't there.
Thanks!