filtering problem

Discussion in 'Google API' started by Epsilon, Mar 26, 2004.

  1. #1
    Hello,

    I've got a problem with the "filter" attribute of the search request.

    The "documentFiltering" of the results is always set to "false", even
    when filtering should be performed (when testing with the same query
    on other google-api engines).

    And the "hostName" of the search results is always empty.

    So it doesn't seems to work, but filter is correctly set to true !

    I don't understand. I asked others php coders, and with the same code
    it works with them. (even if I noticed that filtering doesn't work too
    on some website using google-api, I'm not alone).

    Here's my code (in PHP) :

    $parameters = array(
              "key"         => $key,
              "q"           => $Query,
              "start"       => $start,
              "maxResults"  => $maxResults,
              "filter"      => true,
              "restrict"    => $restrict,
              "safeSearch"  => true,
              "lr"          => $lg,
              "ie"          => "",
              "oe"          => ""
    );
    $soapclient = new soapclient("http://api.google.com/search/beta2");
    $result = $soapclient->call("doGoogleSearch", $parameters,
    "urn:GoogleSearch");
    PHP:
    I saw in an other post that someone had the same problem, and I changed nusoap.php like indicated :

    if ($uqType == 'boolean' && !$value) {
                        $value = 'false';
                    } elseif ($uqType == 'boolean') {
                        $value = 'true';
                    }
    PHP:
    But it still doesn't work

    Can you help me please ?

    Thanks
    Epsilon
     
    Epsilon, Mar 26, 2004 IP
  2. Epsilon

    Epsilon Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hmm I fixed the problem:

    nusoap.php, line 0223:

    replace
    case (is_bool($val) || $type == 'boolean'):
                    if(!$val){
                        $val = 0;
                    }
    PHP:
    by

    case (is_bool($val) || $type == 'boolean'):
                    if(!$val){
                        $val = 'false';
                    }
                    else $val = 'true';
    PHP:
     
    Epsilon, Mar 26, 2004 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    I think it must be a common issue with nusoap, because someone else had the same problem shown here.

    - Shawn
     
    digitalpoint, Mar 26, 2004 IP
  4. Rian

    Rian Well-Known Member

    Messages:
    1,763
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    125
    #4
    I totally agree, I made myself guilty of lazy coding by using the select * statement. I had a large number of databases, tables and fields, which significantly slowed down my performance and was a heavy load on my server resources. Fixed it all, selected only the fields I required and everything was back to normal.
     
    Rian, May 27, 2010 IP