<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vinsol - Leading Ruby on Rails Development and Consulting Firm in India &#187; yahoo boss</title>
	<atom:link href="http://vinsol.com/blog/tag/yahoo-boss/feed/" rel="self" type="application/rss+xml" />
	<link>http://vinsol.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 11 Jan 2012 06:07:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Integrating Yahoo! BOSS with your ruby on rails application</title>
		<link>http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=integrating-yahoo-boss-with-your-rails-application</link>
		<comments>http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 08:08:05 +0000</pubDate>
		<dc:creator>Amit Solanki</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[yahoo boss]]></category>

		<guid isPermaLink="false">http://vinsol.com/blog/?p=740</guid>
		<description><![CDATA[What is Yahoo! BOSS? Yahoo developer website cites it as:
&#8220;Yahoo! Search BOSS (Build your Own Search Service) is an initiative in Yahoo! Search to open up Yahoo!&#8217;s search infrastructure and enable third parties to build revolutionary search products leveraging their own data, content, technology, social graph, or other assets. This release includes Web, News, and [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>What is <strong>Yahoo! BOSS</strong>? Yahoo developer website cites it as:</p>
<p style="text-align:justify"><cite>&#8220;Yahoo! Search BOSS (Build your Own Search Service) is an initiative in Yahoo! Search to open up Yahoo!&#8217;s search infrastructure and enable third parties to build revolutionary search products leveraging their own data, content, technology, social graph, or other assets. This release includes Web, News, and Image Search as well as Spelling Suggestions.&#8221;</cite></p>
<p>Some of the possible implementation of Yahoo! Boss may be finding related posts for your article, suggested tag/category for an article/query, correcting misspelled words by providing suggestions, fetching latest news on a topic dynamically, search over delicious tags, customized language search. Some of these have been tried and successfully implemented. An example is the <a href="http://www.techcrunch.com/2008/11/26/techcrunchs-new-search-engine-powered-by-yahoo-boss/">TechCrunch&#8217;s Search Engine</a>.</p>
<p> Here is a concise guide on how to use this new service in your next rails application.</p>
<p><strong>Obtain API key</strong></p>
<p>Get an application key from <a href="http://developer.yahoo.com/search/boss/">http://developer.yahoo.com/search/boss/</a>.</p>
<p><strong>Install BOSSMan Gem</strong></p>
<p>BOSSMan is a gem for interaction with the Yahoo BOSS web service written by <a href="http://github.com/jpignata">John Pignata</a>. Install it using the following commands:</p>
<pre class="brush: bash;">
gem install gemcutter
gem tumble
gem install bossman
</pre>
<p><strong>Usage</strong></p>
<p>Put this in your environment.rb</p>
<pre class="brush: ruby;">
require 'bossman'
include BOSSMan
BOSSMan.application_id = &lt;Your Application ID&gt;
</pre>
<p><strong>Web Search</strong></p>
<p>Use the following code to execute search over the web:</p>
<pre class="brush: ruby;">
boss = Search.web(&quot;Apple Pie&quot;, { :count =&gt; 2, :filter =&gt; &quot;-hate&quot; })
puts &quot;Number of results: #{boss.totalhits}&quot;

boss.results.each do |result|
  puts &quot;#{result.title}&quot;
  puts &quot;#{result.dispurl}&quot;
  puts &quot;#{result.abstract}&quot;
end

# =&gt; Number of results: 2618888
# =&gt; &lt;b&gt;Apple&lt;/b&gt; &lt;b&gt;pie&lt;/b&gt; - Wikipedia, the free encyclopedia
# =&gt; &lt;b&gt;en.wikipedia.org&lt;/b&gt;/wiki/&lt;wbr&gt;&lt;b&gt;Apple&lt;/b&gt;_&lt;b&gt;pie&lt;/b&gt;
# =&gt; English &lt;b&gt;apple&lt;/b&gt; &lt;b&gt;pie&lt;/b&gt; recipes go back to the time of Chaucer. &lt;b&gt;...&lt;/b&gt; The basis of Dutch &lt;b&gt;apple&lt;/b&gt; &lt;b&gt;pie&lt;/b&gt; is a crust on the bottom and around the edges. &lt;b&gt;...&lt;/b&gt;

boss = Search.web(&quot;Moon&quot;, { :count =&gt; 10, :type =&gt; &quot;nonhtml,-pdf&quot; })

boss.results.each do |result|
  puts &quot;#{result.title}&quot;
  puts &quot;#{result.dispurl}&quot;
  puts &quot;#{result.abstract}&quot;
end

# =&gt; BACKGROUND:
# =&gt; www.&lt;b&gt;radford.edu&lt;/b&gt;/~rusmart/&lt;wbr&gt;&lt;b&gt;moon&lt;/b&gt;.doc
# =&gt; We noticed was that one of the scan lines took longer to scan the &lt;b&gt;moon&lt;/b&gt; then any other. This occurred toward the middle of the &lt;b&gt;moon&lt;/b&gt;. &lt;b&gt;...&lt;/b&gt;

boss = Search.web(&quot;Star&quot;, { :sites =&gt; &quot;wwe.com&quot;, :style=&gt;'raw' })
boss.results.each do |result|
  puts &quot;#{result.title}&quot;
  puts &quot;#{result.dispurl}&quot;
  puts &quot;#{result.abstract}&quot;
end

# =&gt; John Cena - WWE: Raw
# =&gt; www.&lt;b&gt;wwe.com&lt;/b&gt;/super&lt;b&gt;star&lt;/b&gt;s/raw/&lt;wbr&gt;johncena
# =&gt; Official profile from WWE for the professional wrestler John Cena, who has been training since he was 15. Features lots of photos and video clips, including John ...
</pre>
<p>Apart from <a href="#universal_arguments">universal arguments</a> mentioned at the end of this document, the following arguments can also be used:<br />
<script>
function toggleDiv(divid){
if(document.getElementById(divid).style.display == 'none'){
document.getElementById(divid).style.display = 'block';
}else{
document.getElementById(divid).style.display = 'none';
}
}
</script></p>
<style>
#universal_arguments td, #universal_arguments th, #web_search_arguments td, #web_search_arguments th, #web_response_fields td, #web_response_fields th, #image_search_arguments td, #image_search_arguments th, #image_response_fields th, #image_response_fields td, #news_search_arguments th, #news_search_arguments td, #news_response_fields td, #news_response_fields th{padding: 5px; vertical-align:top;}
#web_search_arguments li {list-style-type:none; background: none}
</style>
<table border="0" cellspacing="0" id="web_search_arguments">
<tbody>
<tr>
<th>Parameters</th>
<th>Values/Description</th>
</tr>
<tr>
<td><code>:filter</code></td>
<td>
Filter out adult or hate content<br />
Syntax: <code>:filter => "-hate, -porn"</code>
</td>
</tr>
<tr>
<td><code>:type</code></td>
<td>Specifies document formats (pdf, msoffice,etc)</td>
</tr>
<tr>
<td>:view</td>
<td>Syntax: <code>:view => "view1,view2"</code>, etc</p>
<p><code>:view => "keyterms"</code> will retrieve related words and phrases for each search result.</p>
<p><code>:view => "searchmonkey_feed"</code> will retrieve structured data markup, if available, for the search result in dataRSS format.</p>
<p><code>:view => "searchmonkey_rdf"</code> will retrieve structured data markup, if available, for the search result in rdf format.</p>
<p><code>:view => "delicious_toptags"</code> will retrieve the top public delicious tags for a document and the counts associated with each tag</p>
<p><code>:view => "delicious_saves"</code> will retrieve the number of times a document was saved in delicious</p>
<p><code>:view => "language"</code> identifies the language of the document</p>
</td>
</tr>
<tr>
<td>:abstract</td>
<td><code>:abstract => "long"</code> will retrieve and display an abstract of a web document up to 300 characters. This expanded abstract provides the requestor with a larger piece of information to work from in a web search query. The default for abstract is an abbreviated description.</td>
</tr>
</tbody>
</table>
<p>Click <a href="javascript:toggleDiv('web_response_fields')">here</a> to view list of response fields returned by web search.</p>
<table border="0" cellpadding="5" cellspacing="0" id="web_response_fields" style="display:none">
<tbody>
<tr>
<th>Fields</th>
<th>Details</th>
</tr>
<tr>
<td><code>count</code></td>
<td>Indicates how many results to show per page. The value shown in results is the smaller of the default or explicit “count” request argument value or the actual number of results in the response. The result set will include the requested “count” unless there are fewer than that number of matching documents.</td>
</tr>
<tr>
<td><code>totalhits</code></td>
<td>A result count that reflects no duplicates. The totalhits value is an approximation, and its value may change depending on the requested “start” and “count” values, because the approximation is adjusted as more exact result URLs are processed. A normal use for totalhits is to determine how many pages of results to offer in search result navigation. Since totalhits is an approximation, and the value may change as “start” increases on successive result pages, the result page navigation may need to be adjusted as a user browses result pages.</td>
</tr>
<tr>
<td><code>deephits</code></td>
<td>It returns an approximate count that reflects duplicate documents and all documents from a host. deephits, therefore, is invariably equal to or larger than TotalHits. The deephits value is normally used as an information display on a search result page, reporting how many total documents matched the search terms.</td>
</tr>
<tr>
<td><code>abstract</code></td>
<td>Abstract with keywords highlighted with HTML tags. abstract=long  will retrieve and display an abstract of a web document up to 300 characters. This expanded abstract provides the requester with a larger piece of information to work from in a web search query. </td>
</tr>
<tr>
<td><code>title</code></td>
<td>Title with keywords highlighted with HTML tags</td>
</tr>
<tr>
<td><code>url</code></td>
<td>URL of result</td>
</tr>
<tr>
<td><code>clickurl</code></td>
<td>Returns a navigation URL that leads to the target URL for each result. A clickurl might lead through a redirect server, which provides Yahoo! with important usage data from search result sets.</td>
</tr>
<tr>
<td><code>dispurl</code></td>
<td>Returns the URLs of documents matching the query result. Use this field only for display purposes on result pages. To direct search users to the target document, use the clickurl value</td>
</tr>
<tr>
<td><code>size</code></td>
<td>Returns the document’s size in bytes</td>
</tr>
<tr>
<td><code>date</code></td>
<td>Returns date in YYYY/MM/DD format</td>
</tr>
<tr>
<td><code>keyterms</code></td>
<td>When <code>:view => "keyterms"</code> is used in query string the keyterms section is included in the response. This includes a list of related words and phrases with the <code>term</code> subheadings.</td>
</tr>
<tr>
<td><code>searchmonkey_feed</code></td>
<td>Using this field will retrieve structured data markup, if available, for the search result in dataRSS format.</td>
</tr>
<tr>
<td><code>searchmonkey_rdf</code></td>
<td>Using this field will retrieve structured data markup, if available, for the search result in RDF format.</td>
</tr>
<tr>
<td><code>delicious_toptags</code></td>
<td>Retrieves the top public delicious tags for a document and the counts associated with each tag.</td>
</tr>
<tr>
<td><code>delicious_saves</code></td>
<td>The number of times a document was saved in delicious.</td>
</tr>
<tr>
<td><code>language</code></td>
<td>The language of the document.</td>
</tr>
</tbody>
</table>
<p><strong>Images Search</strong></p>
<p>For searching images on web, use the following code:</p>
<pre class="brush: ruby;">
boss = Search.images(&quot;snow hills&quot;, { :dimensions =&gt; &quot;large&quot; })

boss.results.each do |result|
  puts &quot;#{result.url}: #{result.abstract}&quot;
end

# =&gt; http://www.amanita-photolibrary.co.uk/photo_library/BI_habitats/gb96_chiltern_hills_from_ivinghoe_snow_std.jpg: Copyright © 2004 Chiltern hills east from near Ivinghoe snow habitats landscapes British Isles
</pre>
<p>Click <a href="javascript:toggleDiv('image_search_arguments')">here</a> for list of additional arguments that can be provided with image search. </p>
<table border="0" cellpadding="5" cellspacing="0" id="image_search_arguments" style="display:none">
<tbody>
<tr>
<th>Parameters</th>
<th>Values</th>
<th>Description</th>
</tr>
<tr>
<td><code>:filter</code></td>
<td><code>yes</code> (default) or <code>no</code></td>
<td>Whether or not to activate the Offensive Content Reduction filter. If set to yes, content marked as offensive is omitted from results.</td>
</tr>
<tr>
<td><code>:dimensions</code></td>
<td><code>all</code> (default), <code>small</code>, <code>medium</code>, <code>large</code>, <code>wallpaper</code>, <code>widewallpaper</code></td>
<td>Small images are generally thumbnail or icon sized. Medium sized images are average sized; usually not exceeding an average screen size. Large images are screen size or larger. Size pairs other than those listed are ignored.</td>
</tr>
<tr>
<td><code>:refererurl</code></td>
<td>URL, no default</td>
<td>
Search for this URL. Depending on other query restrictions, returns all image objects with this referring URL.</p>
<p>Example:  http://www.foo.com/~foo/images.htm
</td>
</tr>
<tr>
<td><code>:url</code></td>
<td>URL, no default</td>
<td>Search for this URL. Returns this exact image result.</p>
<p>Example: http://www.foo.com/~foo/images/mydog.gif
</td>
</tr>
</tbody>
</table>
<p>Click <a href="javascript:toggleDiv('image_response_fields')">here</a> to view list of response fields returned by image search.</p>
<table border="0" cellpadding="5" cellspacing="0" id="image_response_fields" style="display:none">
<tbody>
<tr>
<th>Field Name</th>
<th>Description</th>
</tr>
<tr>
<td><code>totalhits, deephits</code></td>
<td>Number of listings that match the query parameters.</td>
</tr>
<tr>
<td><code>abstract</code></td>
<td>Description of image</td>
</tr>
<tr>
<td><code>clickurl</code></td>
<td>URL to click to view image </td>
</tr>
<tr>
<td><code>filename</code></td>
<td>Filename of image</td>
</tr>
<tr>
<td><code>size</code></td>
<td>Size of image file </td>
</tr>
<tr>
<td><code>format</code></td>
<td>Format of image </td>
</tr>
<tr>
<td><code>height</code></td>
<td>Height of full-size image </td>
</tr>
<tr>
<td><code>date</code></td>
<td>Last modification date of image YYYY/MM/DD</td>
</tr>
<tr>
<td><code>mimetype</code></td>
<td>MIME type of image </td>
</tr>
<tr>
<td><code>refererclickurl</code></td>
<td>Clickable link to page in which image was found </td>
</tr>
<tr>
<td><code>refererurl</code></td>
<td>Original link to page in which image was found </td>
</tr>
<tr>
<td><code>title</code></td>
<td>Title of image (usually the filename) </td>
</tr>
<tr>
<td><code>url</code></td>
<td>URL of image itself </td>
</tr>
<tr>
<td><code>width</code></td>
<td>Width of full-size image </td>
</tr>
<tr>
<td><code>thumbnail_url</code></td>
<td>Thumbnail image</td>
</tr>
<tr>
<td><code>thumbnail_height</code></td>
<td>Thumbnail height</td>
</tr>
<tr>
<td><code>thumbnail_width</code></td>
<td>Thumbnail width</td>
</tr>
</tbody>
</table>
<p><strong>News Search</strong></p>
<p>Yahoo! BOSS also provides news search capabilties. </p>
<pre class="brush: ruby;">
boss = BOSSMan::Search.news(&quot;free shipping&quot;, { :age =&gt; &quot;1d-2w&quot;, :orderby =&gt; &quot;date&quot;, :count =&gt; 1})

boss.results.each do |result|
  puts &quot;#{result.title} [from #{result.source}]&quot;
  puts &quot;#{result.abstract}&quot;
end
# =&gt; Wal-Mart announces weekly price cuts for holidays [from USA Today]
# =&gt; Wal-Mart said it will cut prices this holiday season for a week at a time on thousands of items, from bananas to board games. The first group of cuts hit Wednesday.
</pre>
<p>Click <a href="javascript:toggleDiv('news_search_arguments')">here</a> for list of additional arguments that can be provided with news search. </p>
<table border="0" cellpadding="5" cellspacing="0" id="news_search_arguments" style="display:none">
<tbody>
<tr>
<th>Parameters</th>
<th>Values</th>
<th>Description</th>
</tr>
<tr>
<td><code>:age</code></td>
<td><code>7d</code></td>
<td>Use age= to retrieve documents by age:<br />
<code>:age => "[value]d"</code><br />
NOTE: Maximum [value] cannot be greater than 1000.<br />
The default is 30 days, and valid values are <code>[1-30]d</code>. (News Search maintains a 30-day index.) The following example searches the full index:<br />
<code>:age => "7d"</code><br />
Age can be specified using a string made an integer and one of the letters &#8220;<code>s</code>&#8220;, &#8220;<code>m</code>&#8220;, &#8220;<code>h</code>&#8220;, &#8220;<code>d</code>&#8221; and &#8220;<code>w</code>&#8221; representing seconds, minutes, hours, days and weeks.<br />
No spaces are allowed in the string. Some examples:<br />
<code>:age => "30d"</code><br />
<code>:age => "1w"</code><br />
<code>:age => "12h"</code><br />
To specify an age range two values can be concatenated with a dash/hyphen for example:<br />
<code>:age => "5d-10d"</code> Between 5 and 10 days old<br />
<code>:age => "2w-30d"</code> Between 2 weeks and 30 days old<br />
Multiple ranges or more than one age parameter is not supported. </td>
</tr>
<tr>
<td><code>:orderby</code></td>
<td>relevance</td>
<td>To order by date add <code>:orderby => "date"</code> to the query string. Results will be returned with the most recent first. </td>
</tr>
</tbody>
</table>
<p>Click <a href="javascript:toggleDiv('news_response_fields')">here</a> to view list of response fields returned by news search.</p>
<table border="0" cellpadding="5" cellspacing="0" id="news_response_fields" style="display:none">
<tbody>
<tr>
<th>Field Name</th>
<th>Description</th>
</tr>
<tr>
<td><code>totalhits, deephits</code></td>
<td>Number of listings that match the query parameters.</td>
</tr>
<tr>
<td><code>abstract</code></td>
<td>Abstract of news story.</td>
</tr>
<tr>
<td><code>clickurl</code></td>
<td>Click this link to reach story, if present. </td>
</tr>
<tr>
<td><code>language</code></td>
<td>Language of story. </td>
</tr>
<tr>
<td><code>date</code></td>
<td>Last publication date of story. </td>
</tr>
<tr>
<td><code>time</code></td>
<td>Last publication time of story.</td>
</tr>
<tr>
<td><code>source</code></td>
<td>Source publication. </td>
</tr>
<tr>
<td><code>sourceurl</code></td>
<td>URL of source publication. </td>
</tr>
<tr>
<td><code>title</code></td>
<td>Title (or Headline) of the story. </td>
</tr>
<tr>
<td><code>url</code></td>
<td>Link to story.</td>
</tr>
</tbody>
</table>
<p><strong>Spelling Search</strong></p>
<p>Correct your misspelled words using its spelling suggestion feature:</p>
<pre class="brush: ruby;">
boss = BOSSMan::Search.spelling(&quot;acknowlegment&quot;)
puts boss.suggestion # =&gt; acknowledgment
</pre>
<p><strong>Site Explorer</strong></p>
<p>You can also search for the pages from other sites linking into your site pages.</p>
<pre class="brush: ruby;">
links = Search.se_inlink(&quot;http://mail.yahoo.com&quot;, :count =&gt; 2)
links.results.map { |result| p result.url }
# =&gt; http://www.aol.com/
# =&gt; http://groups.yahoo.com/
</pre>
<p>For displays a list of all pages belonging to a domain in the Yahoo! index, use se_pagedata method provided.</p>
<pre class="brush: ruby;">
links = Search.se_pagedata(&quot;twitter.com&quot;, :count =&gt; 1)
links.results.map { |result| p &quot;#{result.url} - #{result.abstract}&quot; }
# =&gt; http://twitter.com/ - Use Twitter to send status updates (tweets) through your cell phone, instant messenger, or via the Web, and notify friends and followers of the little things &lt;b&gt;...&lt;/b&gt;
</pre>
<p><strong>Universal Arguments for Web, Images and News</strong></p>
<p>Following is the list of most commonly used arguments with web, image and news search. For more comprehensive list click <a href="http://developer.yahoo.com/search/boss/boss_guide/overview.html">here</a></p>
<table border="0" cellpadding="5" cellspacing="0" id="universal_arguments">
<tbody>
<tr>
<th>Argument</th>
<th>Options/Details</th>
</tr>
<tr>
<td><code>:start</code></td>
<td>Ordinal position of first result. First position is 0. Default sets start to 0.</td>
</tr>
<tr>
<td><code>:count</code></td>
<td>Total number of results to return. Maximum value is 50. Default sets count to 10.</td>
</tr>
<tr>
<td><code>:format</code></td>
<td>The data format of the response. Value can be set to either <code>"xml"</code> or <code>"json"</code>. Default sets format to <code>"json"</code>.</td>
</tr>
<tr>
<td><code>:callback</code></td>
<td>The name of the callback function to wrap the result. Parameter is valid only if format is set to <code>"json"</code>. No default value exists.</td>
</tr>
<tr>
<td><code>:sites</code></td>
<td>Restrict BOSS search results to a set of pre-defined sites. Multiple sites must be comma separated. Example: (<code>:sites => "abc.com,cnn.com"</code>). The Images service does not yet support multiple sites.</td>
</tr>
<tr>
<td><code>:view</code></td>
<td>Retrieve additional search data provided by the respective BOSS service. Please see individual chapters to see what view options are available.</td>
</tr>
<tr>
<td><code>:style</code></td>
<td>By default for web search result titles and abstracts contain bold HTML tags around the search term. Use <code>:style => "raw"</code> to remove the bold tags around the search terms in titles and abstracts.</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://vinsol.com/blog/2009/10/29/integrating-yahoo-boss-with-your-rails-application/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

