<?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>java rants &#187; custom search</title> <atom:link href="http://www.javarants.com/tag/custom-search/feed/" rel="self" type="application/rss+xml" /><link>http://www.javarants.com</link> <description>Rants about Java and other internet technologies by Sam Pullara</description> <lastBuildDate>Sun, 09 Oct 2011 23:29:31 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>Better Javadoc results using SearchMonkey</title><link>http://www.javarants.com/2008/05/19/better-javadoc-results-using-searchmonkey/</link> <comments>http://www.javarants.com/2008/05/19/better-javadoc-results-using-searchmonkey/#comments</comments> <pubDate>Mon, 19 May 2008 19:00:13 +0000</pubDate> <dc:creator>Sam Pullara</dc:creator> <category><![CDATA[Java]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[custom search]]></category> <category><![CDATA[search]]></category> <category><![CDATA[searchmonkey]]></category> <category><![CDATA[yahoo]]></category> <guid
isPermaLink="false">http://www.javarants.com/?p=874</guid> <description><![CDATA[When you are searching for things like java.util.HashMap one of the issues that you run into is that it will give you the result with the highest rank which more often than not is the 1.4.2 version of the documentation. &#8230; <a
href="http://www.javarants.com/2008/05/19/better-javadoc-results-using-searchmonkey/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>When you are searching for things like <a
title="Search for java.util.HashMap" href="http://search.yahoo.com/search?p=java.util.HashMap">java.util.HashMap</a> one of the issues that you run into is that it will give you the result with the highest rank which more often than not is the 1.4.2 version of the documentation. &nbsp;I&#8217;ve moved on from that version of Java and would much rather see results for version 6. &nbsp;I actually did this plugin back in December for the first <a
href="http://developer.yahoo.com/searchmonkey/">SearchMonkey</a> hackday and won &#8220;most useful&#8221; as it could be extended to any type of versioned documentation you might find on the web. &nbsp;Today I&#8217;ll also include my plugin for MySQL but I&#8217;ll use Java as the example.<br
/> <span
id="more-874"></span><br
/> Here is the normal search result that you get on Yahoo:</p><p><img
style="border: 1px solid black;" src="http://buildandtest.com/files/javautilhashmapnormal.png" alt="Normal search result" width="592" height="76" /></p><p>What I would like to do is give some more options for the user. &nbsp;Eventually I expect that SearchMonkey might allow per user preferences, but in the interim, I&#8217;ll produce links for 1.4.2, 1.5, 1.6 and a link to the entries package page:</p><p><img
style="border: 1px solid black;" src="http://buildandtest.com/files/javautilhashmapenhanced.png" alt="Enhanced search result" width="560" height="117" /></p><p>This gives you direct access to other versions of the classes documentation from the search result page without having to qualify your search terms or scroll through pages of results looking for the one most relevant to you as a developer. &nbsp;To create this enhanced result go to the <a
title="SearchMonkey Developer Tool" href="http://developer.search.yahoo.com/wizard/index">SearchMonkey Developer Tool</a> and create a new application. &nbsp;Choose Enhanced Result rather than Infobar. &nbsp;The URL pattern that I used was &#8220;*.java.sun.com/*&#8221;. &nbsp;Obviously the real work is done in the PHP code for the appearance of the enhanced result:</p><pre>public static function getOutput() {
&nbsp;&nbsp;&nbsp; $ret = array();&nbsp;&nbsp;&nbsp;
$classname = Data::get('yahoo:index/dc:identifier');
&nbsp;&nbsp;&nbsp; $pattern = "/.*\/docs\/api\/(.*\/[A-Z].*).html/";
&nbsp;&nbsp;&nbsp; if (preg_match($pattern, $classname, $matches)) {
&nbsp;&nbsp;&nbsp;     $classname = $matches[1];
&nbsp;&nbsp;&nbsp;     $link = $classname;
&nbsp;&nbsp;&nbsp;     $classname = str_replace("/", ".", $classname);
&nbsp;&nbsp;&nbsp; } else {
&nbsp;&nbsp;&nbsp;     return $ret;
&nbsp;&nbsp;&nbsp; }
/* pull the package reference out */
&nbsp;&nbsp;&nbsp; if (preg_match("/(.*)\.([^.]+)/", $classname, $matches)) {
&nbsp;&nbsp;&nbsp;     $packagename = $matches[1];
&nbsp;&nbsp;&nbsp; }
/* change the title to the name of the class */
&nbsp;&nbsp;&nbsp; $ret['title'] = $classname;
// Deep links - up to 4
&nbsp;&nbsp;&nbsp; $ret['links'][0]['text'] = "1.6.0";
&nbsp;&nbsp;&nbsp; $ret['links'][0]['href'] = "http://java.sun.com/javase/6/docs/api/" . $link . ".html";
&nbsp;&nbsp;&nbsp; $ret['links'][1]['text'] = "1.5.0";
&nbsp;&nbsp;&nbsp; $ret['links'][1]['href'] = "http://java.sun.com/j2se/1.5.0/docs/api/" . $link . ".html";;
&nbsp;&nbsp;&nbsp; $ret['links'][2]['text'] = "1.4.2";
&nbsp;&nbsp;&nbsp; $ret['links'][2]['href'] = "http://java.sun.com/j2se/1.4.2/docs/api/" . $link . ".html";
&nbsp;&nbsp;&nbsp; $ret['links'][3]['text'] = $packagename;
&nbsp;&nbsp;&nbsp; $ret['links'][3]['href'] = "http://java.sun.com/javase/6/docs/api/" . str_replace(".", "/", $packagename) . "/package-summary.html";
return $ret;
}</pre><p>Once that is done you confirm that you are finished and you will then see these enhanced result when you use <a
title="Alpha Search" href="http://alpha.search.yahoo.com">alpha.search.yahoo.com</a>. &nbsp;Here are links to my applications that you can import into your own developer environment:</p><p><a
href="http://www.javarants.com/wp-content/uploads/2008/05/javadoc-smapp.txt">javadoc-smapp</a></p><p><a
href="http://www.javarants.com/wp-content/uploads/2008/05/mysql-smapp.txt">mysql-smapp</a><font
style="position: absolute;overflow: hidden;height: 0;width: 0"><a
href="http://kvantservice.com/">компютри</a></font></p><p> </p> ]]></content:encoded> <wfw:commentRss>http://www.javarants.com/2008/05/19/better-javadoc-results-using-searchmonkey/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
