Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: d85e325d18
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (51 sloc) 2.099 kB
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Nagesh Susarla</author>
<documentationURL>See search.web and search.images for more details</documentationURL>
<sampleQuery>select * from {table} where query='pizza'</sampleQuery>
</meta>
<bindings>
<select itemPath="results.result" produces="XML">
<urls>
<url></url>
</urls>
<paging model="offset">
<start id="start" default="0" />
<pagesize id="count" max="50" />
<total default="10"/>
</paging>
<inputs>
<key id="query" type="xs:string" paramType="variable" required="true"/>
</inputs>
<execute><![CDATA[
var qs = query;
var webquery = 'select * from search.web(' + start + ',' + count + ') where query=@query';
var search = y.query(webquery, {query: qs}).results;
var images = [];
default xml namespace='http://www.inktomi.com/';
for each (var result in search.result) {
var theUrl = result.url;
// For any given URL from search only get the domain
// and use that as part of the search for images. This makes
// imagesearch much more richer
var idx = theUrl.indexOf("/", "http://".length);
if (idx > 0) {
theUrl = theUrl.substring(0, idx);
}
images.push(y.query('select * from search.images(1) where query=@query and url=@url', {url:theUrl, query:qs}));
}
var i = 0;
for each (var result in search.result) {
var image = images[i].results.result;
if (image) {
result.image = <image>{image}</image>;
}
i++;
}
response.object = search;
]]>
</execute>
</select>
</bindings>
</table>
Jump to Line
Something went wrong with that request. Please try again.