<?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>SofaRider &#187; wordpress search</title>
	<atom:link href="http://rider.sofarider.com/tag/wordpress-search/feed/" rel="self" type="application/rss+xml" />
	<link>http://rider.sofarider.com</link>
	<description>WordPress Themes, Widgets, Development &#124; WEB &#38; Graphic Design</description>
	<lastBuildDate>Wed, 14 Oct 2009 08:40:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WP Search page results &#8211; how to display Match percentage</title>
		<link>http://rider.sofarider.com/blog/wordpress-tips/wp-search-page-results-how-to-display-match-percentage/</link>
		<comments>http://rider.sofarider.com/blog/wordpress-tips/wp-search-page-results-how-to-display-match-percentage/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 06:37:46 +0000</pubDate>
		<dc:creator>Feeleep</dc:creator>
				<category><![CDATA[Wordpress Tips]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[match percentage]]></category>
		<category><![CDATA[search results]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[wordpress search]]></category>

		<guid isPermaLink="false">http://rider.sofarider.com/?p=63</guid>
		<description><![CDATA[I haven&#8217;t seen it so far implemented in WordPress, anybody else? OK, here&#8217;s a little piece of code which will allow you to set the Match percentage on search result page of your WordPress theme. I guess it&#8217;s not hard to represent it graphically if one prefers, however I&#8217;ll stay focused on information only.
Yeah I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://rider.sofarider.com/wp-content/uploads/2009/06/search-icon-200x200.jpg" alt="search-icon" title="search-icon" width="200" height="200" class="alignnone size-thumbnail wp-image-64" />I haven&#8217;t seen it so far implemented in WordPress, anybody else? OK, here&#8217;s a little piece of code which will allow you to set the Match percentage on search result page of your WordPress theme. I guess it&#8217;s not hard to represent it graphically if one prefers, however I&#8217;ll stay focused on information only.<br />
Yeah I know, many will say this info is not relevant or accurate enough but I found it quite useful when searching for specific phrase or string in the woods of search results.</p>
<pre>
<code>
&lt;?php
	// 'search.php'...get the search string $_GET[ 's' ], compare with content
	similar_text( $_GET[ 's' ], get_the_content(), $percentMatch );
    // round up result
	$percentMatch = round( $percentMatch * 100 );
    // get rid of inflates
	if( $percentMatch &gt; 100 ) $percentMatch = 100;
    // output result
	echo 'Match: &lt;strong&gt;' . $percentMatch . '%&lt;/strong&gt;';
?&gt;
</code>
</pre>
<p>Note that you will have to use this code within the loop. Otherwise <a href="http://codex.wordpress.org/Function_Reference/get_the_content">get_the_content()</a> is quite useless. I&#8217;m not sure whether similar_text() may affect server&#8217;s performance and slow down your site a bit&#8230;I guess there are people knowing better than myself and willing to share their knowledge.</p>
]]></content:encoded>
			<wfw:commentRss>http://rider.sofarider.com/blog/wordpress-tips/wp-search-page-results-how-to-display-match-percentage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
