Date post: | 21-Jan-2015 |
Category: |
Technology |
Upload: | ted-drake |
View: | 1,515 times |
Download: | 2 times |
BOSS PowerTed DRAKE
Yahoo! FranceBucharest, Romania 6-7/11/2008
Brief intro•I joined Yahoo! in 2005 to work on the
first major mash up in web 2.0: Yahoo! Tech
•I have worked on Answers, Finance, Canadian Finance, Global Finance, Platforms, Accessibility Stakeholders Group, IE7 Task Force, and International Yahoo! Developer Network.
•I studied fine arts, not computer science.
BOSS Basics
Exactly the same as other search APIs
Only completely different!
BOSS Basics•Free
•No rate limit
•Freedom
MashChange the rankingChange the design
Keep Yahoo! a secretCache and store
results
Use Google APIs
Cross check with Digg
News, Web, Image, Spelling suggestionsGrab user info from Facebook
Flickr Images
Creative Commons
search
HACK!
Search as Engine
•Yahoo! Tech: product category and name used to generate various modules via search on different APIs. (implied query)
•Yahoo! News: Full coverage pages are driven entirely by a search interface (defined query)
What is the most important part of your application?
•The results display?
•The text ads?
•The rounded borders?
•The smooth animations?
•The perfect URL?
THE QUERY STRING!!!
The Query
•Tells you what the user is looking for
•Generates related topics
•Powers secondary APIs
•Can be generated by a search box, URL, tags,or keyword extraction from the page.
•The Query is your BFF!
BOSS Details•REST or SOAP based API. (examples
are REST)
•XML or JSON output
•Web, News, Image, and Spelling Suggestion services
•I18N ready (language, region, UTF-8)
•Recognizes most search filters from Yahoo! and Google (backdoor hacks)
Site Specific Results
•Search only one site:
/ysearch/web/v1/golf+site:vw.com?
•Search from a select group of sites:
/ysearch/web/v1/golf?sites=vw.com,vwtrendsweb.com,performancevwmag.com,caranddriver.com
Tag or Title Filters
•Use the inurl: filter to simulate tag search:
/ysearch/web/v1/inurl:golf?
•Use the intitle: filter to filter by results with query in title
/ysearch/web/v1/intitle:golf?
Get Related Sites
•You can find sites related to each result by triggering secondary queries.
/ysearch/web/v1/related:http://www.caranddriver.com/car/2006-models/2006-golf.html?
BOSS Key Terms
•Each result will have the categories Yahoo has assigned to the page.
•The categories are listed in order of relevance.
•Official Partners can get more details about the relevance.
•/web/v1/scirocco?format=xml&view=keyterms
What this allows?
•Each result can have related searches
•Create an array of all related tags and display the most common at the top of the page (this is what powers the search suggestions on Yahoo! Search)
•Use these quality tags for secondary APIs
What it looks like<keyterms><terms><term>Bucharest</term><term>city</term><term>Romanian</term><term>population</term><term>Romania</term><term>architecture</term><term>city centre</term><term>clubs</term></terms></keyterms>
BOSS Mashup Framework
•Perl based framework to mash BOSS API with secondary web services and proprietary data
•“Easy” to hookup to Google APP Engine (I could never get past the Google signup procedure)
•Powers the infamous YUIL (4 hour search) project.
Lessons Learned
•Don’t forget to declare UTF-8 encoding on the page: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Let PHP do the messy work
BOSS requires url encoding of the request. Use the http_build_query() function
$qrystrarray = array('sites' => $Site, 'appid' => $Appid, 'format' => 'xml', 'start' => $start,
'count' => '15');$qryString = http_build_query($qrystrarray);
Users are Evil•Don’t open your site to Cross Site
Scripting.
•Never trust your users.
•Never display unfiltered User Generated Content!
•This includes query params generated by radio buttons and checkboxes!
Tips for Safety
•encode your Query when creating page title, pagination links, “You searched for...”
$niceQuery = htmlentities($_REQUEST['query']);
$safeQuery = urlencode($_REQUEST['query']);
• Is $_REQUEST[‘page’] a digit?
• Use two letter language descriptions, i.e. en, fr, ro. Test the string length of $_REQUEST[‘lang’]
• Always test your incoming variables.
•
Extra Goodies
•Use Pipes.Yahoo.Com to handle your web service mashups. It handles multi-curl, caching, and returns XML, JSON, or PHP array
•Get around any BOSS limitations by using YQL – REST Post, more queries, etc.
Questions?
•http://last-child.com
•http://v3ggie.com
•http://insiderfood.com
•http://developer.yahoo.com/search/boss