3 replies [Last post]
pebosi@drupal.org's picture
Offline
Uber DonorBug Finder
Joined: 09/05/2007
Juice: 47
Was this information Helpful?

This function could be optimized with something like that:

    $fields = array (
      'billing_first_name',
      'billing_last_name',
      'billing_company',
      'delivery_first_name',
      'delivery_last_name',
      'delivery_company',   
    );   
    for ($i = 5; $i < 11; $i++) {
      $arg[$i] = str_replace('*', '%', check_plain(arg($i)));
      if ($arg[$i] !== '0' && $arg[$i] !== '%') {
        $where .= " AND LOWER(o.".$fiels[($i-5)].") LIKE LOWER('". $arg[$i] ."')";
      }
    }

what do you think?

regards pebosi

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Optimize uc_order_usearch

Do you think you can also investigate my use of % in this query? I believe I may need to be using %% syntax, and I wonder if that is causing the searches to fail for folks that have reported the issues in the past.

pebosi@drupal.org's picture
Offline
Uber DonorBug Finder
Joined: 09/05/2007
Juice: 47
Re: Re: Optimize uc_order_usearch

I got no problems searching orders but maybe i dont understand you ?!?
Where are such issues?

regards pebosi

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Optimize uc_order_usearch

kulvik and then today Sara let me know that when they search for customers by name, it usually fails to find the person they're looking for. However, if they browse the DB, they find it no problem. Both their sites have large numbers of customers, so that could very well be the trouble. In that case, the query definitely should be optimized.

Come to think of it... it might be b/c there are no indexes on customer names. I might have to recommend that to them to see if it helps.