Google Groups Home
Help | Sign in
Find by LIKE in 1.6
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Aaron Vegh  
View profile
 More options Dec 30 2005, 8:23 am
From: Aaron Vegh <aaronv...@gmail.com>
Date: Fri, 30 Dec 2005 08:23:40 -0500
Local: Fri, Dec 30 2005 8:23 am
Subject: Find by LIKE in 1.6
Hi Joel,
Welcome back! And thanks for getting back early, I missed you! :-)

Your release notes for 1.6 indicate that searching by LIKE has not
been implemented, but that there were workarounds. Well, it just so
happens that I need a LIKE search; can you help me out?

Cheers!
Aaron.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joel  
View profile
 More options Dec 30 2005, 12:40 pm
From: "Joel" <joel...@gmail.com>
Date: Fri, 30 Dec 2005 17:40:59 -0000
Local: Fri, Dec 30 2005 12:40 pm
Subject: Re: Find by LIKE in 1.6
Hi Aaron,

I assume that you're using base64 encode to store your data right?

If you're not (i.e you disabled the Escape and Unescape feature), you
can simply pass "LIKE" as the comparator and %partialstring% as the
value. This should return the correct value(s).

If your data is encoded in the database, then you will need to change
your object manually. I will send you a code example later today.

Hope this helps.
Joel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aaron Vegh  
View profile
 More options Dec 30 2005, 12:45 pm
From: Aaron Vegh <aaronv...@gmail.com>
Date: Fri, 30 Dec 2005 12:45:54 -0500
Local: Fri, Dec 30 2005 12:45 pm
Subject: Re: Find by LIKE in 1.6
Naturally, I am using the base64 encoding. It is otherwise so nice.
Looking at the code, I can see why the Base64 presents the problem to
a LIKE query. Looking forward to your code sample.

Cheers,
Aaron.

On 12/30/05, Joel <joel...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joel  
View profile
 More options Dec 30 2005, 8:55 pm
From: "Joel" <joel...@gmail.com>
Date: Fri, 30 Dec 2005 17:55:06 -0800
Local: Fri, Dec 30 2005 8:55 pm
Subject: Re: Find by LIKE in 1.6
Hi Aaron,

To get partial string matching to work with the GetList() function,
you'll need to create a Filter function (similar to the Compare
functions that allows pog to sort objects). It should look like this:

function FilterList($objectList, $attributeToCompare, $value)
{
        $filteredList = array();
        foreach ($objectList as $object)
        {
                if (strpos($object->{$attributeToCompare}, $value))
                {
                        $filteredList[] = $object;
                }
        }
        return $filteredList;

}

Then you can call this function whenever you need to filter your object
list as follows:

$objectList = $objectList->FilterList($objectList, $attributeName,
$value);

However, what this means is that you'll first need to get the entire
object list (or a sublist using another condition) and *then* filter
it. I would suggest coding to accommodate for POG in this scenario, i.e
if you absolutely need partial string matching, then use another
condition to shorten the list.

This is, as you see, not very efficient at all, and that's why we
didn't put it in 1.6. It would have penalized GetList() to accomodate
partial string matching. I don't think there's a way to improve this
drastically, unless base64 is supported natively by mysql or any other
database....

I encourage anyone who might have a better solution to let us know.

But I hope this *patch* helps you get the job done.

Let me know.

Joel


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google