Pages (2): 1 2   
Member
Member
kenholmes   23-10-2008, 19:50
#1

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?

Member
Member
sbillard   24-10-2008, 01:51
#2

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 =

Member
Member
albeezie   24-10-2008, 03:11
#3

Haha, what about putting the "exact tag" or "partial search" as a checkable option?

Administrator
Administrator
acrylian   24-10-2008, 09:02
#4

That might be an idea, but maybe we could try it differently. I think basically all search engines support exact term search if you put the term into quotes. Stephen, maybe we could get that into that, too?

Member
Member
picture-pete   24-10-2008, 12:05
#5

Great, thanks a lot. I just wanted to ask this question

Member
Member
albeezie   24-10-2008, 13:18
#6

The quotes thing is a great idea too. Maybe both the option and stick the quotes thing into partial search.. but what if the tag had quotes?

Member
Member
kenholmes   24-10-2008, 16:10
#7

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.

Administrator
Administrator
acrylian   24-10-2008, 16:13
#8

Well, I think if and how that can be done is more sbillard's part... He did the most of the search anyway.

@albeezie. Since tags are naturally one word keywords I think quotes may be quite unusual...

Member
Member
albeezie   24-10-2008, 16:33
#9

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.

Member
Member
kenholmes   24-10-2008, 16:34
#10

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.

Administrator
Administrator
acrylian   24-10-2008, 17:39
#11

@albeezie: Of course you are right....

Member
Member
albeezie   24-10-2008, 18:32
#12

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.

Administrator
Administrator
acrylian   24-10-2008, 18:49
#13

Absolutly no offense taken!!! I just wanted to agree that tags not always are one word and maybe even include quotes sometime. I had not thought about that.

Member
Member
sbillard   25-10-2008, 01:51
#14

It is not practical to base exact tag searching on use of quote marks. An option is possible, though.

Member
Member
kenholmes   28-10-2008, 21:05
#15

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.

Member
Member
kenholmes   30-10-2008, 21:02
#16

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?

Administrator
Administrator
acrylian   30-10-2008, 21:09
#17

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 ';

Member
Member
kenholmes   30-10-2008, 22:03
#18

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!

Member
Member
sbillard   30-10-2008, 23:29
#19

If you are saying you don't wish the albums having the tags to show, you can omit the album loop from the search page.

Member
Member
kenholmes   04-11-2008, 19:41
#20

Thanks, I'll give that a try!

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.