Issues

ZF-2358: Zend_Service_Yahoo::webSearch 'site' option

Issue Type: Bug Created: 2007-12-27T22:05:40.000+0000 Last Updated: 2009-10-16T19:09:30.000+0000 Status: Resolved Fix version(s): - 1.9.5 (27/Oct/09)

Reporter: Jonathan Maron (jonathan_maron) Assignee: michael depetrillo (klassicd) Tags: - Zend_Service_Yahoo

Related issues: Attachments:

Description

The 'site' option of Zend_Service_Yahoo::webSearch does not work. Whenever it is specified, nothing is returned.

For example, when searching for "mysql" on "www.php.net", many results are returned:

http://search.yahoo.com/search;_ylt=A0geu9VfanRHn3…

Similarly, calling the REST API directly returns results:

http://search.yahooapis.com/WebSearchService/V1/…

However, doing the same with "Zend Framework 1.0.3", nothing is returned.

Using PEAR's Services_Yahoo_Search component, the results are returned correctly.

Sample Code:

<pre class="highlight">// ----------------------------------------------------------------------

// Zend Framework 1.0.3

include_once 'Zend/Service/Yahoo.php';

$yahoo = new Zend_Service_Yahoo('YAHOO_ID');

$results = $yahoo->webSearch('mysql', array('site' => '<a href="www.php.net">www.php.net</a>'));

foreach ($results as $result)
{
    echo $result->Title . '<br></br>';
}

echo "";

// ----------------------------------------------------------------------

// PEAR

include_once 'Services/Yahoo/Search.php';

$yahoo = Services_Yahoo_Search::factory('web');
$yahoo->setAppId('YAHOO_ID');
$yahoo->setSites(array('<a href="www.php.net">www.php.net</a>'));
$yahoo->setQuery('mysql');

$results = $yahoo->submit();

foreach ($results as $result)
{
    echo $result['Title'] . '<br></br>';
}

Comments

Posted by Simone Carletti (weppos) on 2007-12-28T17:23:52.000+0000

I investigated the issue. Here's a few notes:

This is the URI queried by Zend_Service_Yahoo http://search.yahooapis.com/WebSearchService/V1/…

I tried to remove each default parameter and I discovered license parameter can cause some problem when site is not empty, even if any is the default value. I would suggest to remove the default value and left the parameter empty.

Posted by Kevin Golding (caomhin) on 2008-01-11T12:40:22.000+0000

Interesting this query has the "any" license set but returns 511 results:

http://search.yahooapis.com/WebSearchService/V1/…

All that changed is the site searched against. It seems Yahoo aren't consistent in their handling of the matter.

Posted by Wil Sinclair (wil) on 2008-03-21T17:05:31.000+0000

This issue should have been fixed for the 1.5 release.

Posted by Jonathan Maron (jonathan_maron) on 2008-04-11T02:28:18.000+0000

It seems that in Zend Framework 1.5.1, the problem is still not solved.

The following code does not return any results:

<pre class="literal">// Zend Framework 1.5.1

include_once 'Zend/Service/Yahoo.php';

$yahoo = new Zend_Service_Yahoo('YAHOO_ID');

$results = $yahoo->webSearch('mysql', array('site' => '<a href="www.php.net">www.php.net</a>'));

foreach ($results as $result)
{
    echo $result->Title . '<br></br>';
}

echo "";

Removing the ", array('site' => '<www.php.net>')" part of "webSearch" and executing again, returns results.

I personally think that Zend_Service_Yahoo::webSearch, with the 'site' option is a great way to implement a "site search" feature on anyway.

Posted by Kevin Golding (caomhin) on 2008-04-11T03:33:57.000+0000

All the testing I've done suggests there's an inconsistency at Yahoo's end. I think "fixing" it in ZF will be more a case of adding workarounds and exceptions to wrangle the results when we hit bad resultsets like mysql on php.net.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:56.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Simone Carletti (weppos) on 2008-05-13T15:30:47.000+0000

@ Jonathan Maron AFAIK nothing has been done to fix the issue for ZF 1.5 thus it's normal the issue still appears.

If I have a few minutes in the next days I'll give it a look. Needless to say, patches are always welcomed from everyone. :)

Posted by Wil Sinclair (wil) on 2008-06-02T06:29:49.000+0000

Simone, could you please look at this and fix the bug or close the issue? Time to get some closure. :)

Thanks! ,Wil

Posted by Simone Carletti (weppos) on 2008-06-04T03:52:45.000+0000

Hi Wil, I'll try to give it a look.

Posted by Milan Momcilovic (mrp) on 2008-06-21T11:17:28.000+0000

Hi all,

The license parameter causes problems. I tested the Yahoo web search service from my browser using the following URI:

http://search.yahooapis.com/WebSearchService/V1/…

IMO, this should return the results from IMDB but it returns only results from Digg, which the license option ('license=any') does not work correctly.

When license parameter is not used at all, the correct results are returned - try this:

http://search.yahooapis.com/WebSearchService/V1/…

Therefore, I think that the "license" option should be removed from $defaultOptions for now, until Yahoo guys fix this problem.

Thanks, Milan

Posted by Sergei Izvorean (uniqueculture) on 2009-05-13T19:21:09.000+0000

This is still an issue in ZF 1.8.0. However the problem seems to be with Yahoo as it doesn't return any results if "license" parameter is present in REST query string. Once the parameter is removed everything works fine. I've done couple test using just a browser and modifying the query string.

Just need an option not to include "license" parameter in Zend_Yahoo_Service. Currently it is validated and cannot be omitted.

Thanks, Sergei

Posted by michael depetrillo (klassicd) on 2009-10-16T19:09:29.000+0000

I've removed 'license' from the default option array. Site searches now work.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts