<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" -->
<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/"
	>

<channel>
	<title>Ganesh H S</title>
	<link>http://ganeshhs.com</link>
	<description>Thoughts on open source technologies, search engine optimization, website security</description>
	<pubDate>Wed, 20 Aug 2008 08:38:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<item>
		<title>submit site to google yahoo dmoz msn</title>
		<link>http://ganeshhs.com/search-engine-optimization-seo/submit-site-to-google-yahoo-dmoz-msn</link>
		<comments>http://ganeshhs.com/search-engine-optimization-seo/submit-site-to-google-yahoo-dmoz-msn#comments</comments>
		<pubDate>Sun, 06 Jul 2008 08:11:17 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[Google]]></category>

		<category><![CDATA[Search Engine Optimization]]></category>

		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/search-engine-optimization-seo/submit-site-to-google-yahoo-dmoz-msn</guid>
		<description><![CDATA[You had a plan for a business, you need a website, now the website is done. What next?
How do you inform search engines that your website existed and inform them to index your website?
When i started working on Search Engine Optimization ( SEO )  for 3 ecommerce sites in 2006, this was the first [...]]]></description>
			<content:encoded><![CDATA[<p>You had a plan for a business, you need a website, now the website is done. What next?</p>
<p>How do you inform search engines that your website existed and inform them to index your website?</p>
<p>When i started working on <strong>Search Engine Optimization ( SEO ) </strong> for 3 ecommerce sites in 2006, this was the first question i had in mind.</p>
<p>Following are the ways of getting your website indexed by search engines -</p>
<ul>
<li><strong> Submit site to dmoz</strong> -<br />
Go to dmoz  - open directory project and <a href="http://www.dmoz.org/add.html" title="submit site to dmoz directory" rel="noindex,nofollow" target="_blank">submit site to dmoz </a>, search engines (like google, yahoo etc.) get the data from dmoz - open directory and they crawl the websites.</li>
<li><strong> Submit site to google</strong> -<br />
Go to google search and <a href="http://www.google.com/addurl/" title="submit site to google search engine" target="_blank" rel="noindex,nofollow">submit site to google search engine</a>, this will inform google to crawl your website.</li>
<li><strong> Submit site to yahoo </strong>-<br />
Go to yahoo search and <a href="http://search.yahoo.com/info/submit.html" title="submit site to yahoo search " target="_blank" rel="noindex,nofollow">submit site to yahoo search</a>, this will inform yahoo to crawl your website</li>
<li><strong> Submit site to live </strong>-<br />
Go to live search and <a href="http://search.msn.com/docs/submit.aspx" title="submit site to live search " target="_blank" rel="noindex,nofollow">submit site to live search</a>, this will inform live search to crawl your website</li>
<li><strong> <a href="http://ganeshhs.com/search-engine-optimization-seo/sitemaps" title="creating sitemaps" target="_blank">Create sitemap and ping search engines</a> </strong></li>
<li><strong> <a href="http://ganeshhs.com/search-engine-optimization-seo/seo-robotstxt" title="robots.txt" target="_blank">Mention the sitemap path in robots.txt</a><br />
</strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/search-engine-optimization-seo/submit-site-to-google-yahoo-dmoz-msn/feed</wfw:commentRss>
		</item>
		<item>
		<title>set preferred domain</title>
		<link>http://ganeshhs.com/search-engine-optimization-seo/set-preferred-domain</link>
		<comments>http://ganeshhs.com/search-engine-optimization-seo/set-preferred-domain#comments</comments>
		<pubDate>Fri, 04 Jul 2008 12:20:19 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[Google]]></category>

		<category><![CDATA[Search Engine Optimization]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/uncategorized/set-preferred-domain</guid>
		<description><![CDATA[I always thought following links are same -
http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow
http://www.ganeshhs.com/search-engine-optimization-seo/noindex-nofollow
Above links leads to the same page, but it differs with www.
But search engine treats both links are different, i have seen in few cases where we link many a times we ignore www. and in some cases we do include www. in the links.
So what are the [...]]]></description>
			<content:encoded><![CDATA[<p>I always thought following links are same -<br />
http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow<br />
http://www.ganeshhs.com/search-engine-optimization-seo/noindex-nofollow</p>
<p>Above links leads to the same page, but it differs with www.<br />
But search engine treats both links are different, i have seen in few cases where we link many a times we ignore www. and in some cases we do include www. in the links.</p>
<p>So what are the impacts?</p>
<ol>
<li>Search engines keep both the versions of the URLs, when people click on search engine results links which leads to our site with different versions of these URLs, it will drastically affect the page rank and traffic.</li>
<li>These URLs look like different documents to crawlers and create excessive crawling on our website.</li>
</ol>
<p>How do we instruct search engine to treat both the URL&#8217;s as same, Google webmasters tool has a option to <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=44232" title="Google Webmaster tool | Set the prefered domain" target="_blank">set the preferred domain </a></p>
<p>So  whats the advantage of <strong>set preferred domain </strong>? If i set my preferred domain as ganeshhs.com and next time if Google comes and crawls my website, and if it finds any link starting with www.ganeshhs.com it will follow it as ganeshhs.com and when Google displays my website links in search results it will show the links as ganeshhs.com</p>
<p>It also helps us to fix the external site referrals,  few guys started provide links to my website, if suppose their referral link is http://www.ganeshhs.com/category/search-engine-optimization-seo where as my actual article URL was http://ganeshhs.com/category/search-engine-optimization-seo and when google crawls our website through that referral link it will keep the right version of domain what we preferred.</p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/search-engine-optimization-seo/set-preferred-domain/feed</wfw:commentRss>
		</item>
		<item>
		<title>noindex nofollow</title>
		<link>http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow</link>
		<comments>http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow#comments</comments>
		<pubDate>Fri, 04 Jul 2008 11:26:13 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[Search Engine Optimization]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow</guid>
		<description><![CDATA[HTML  tag tells robots not to index the content of a page, and/or not scan it for links to follow, keeping this metatag for pages which we don&#8217;t want to index, nor to follow the links on the webpage is helpful.
In some cases, we come across situations where we keep links to external sites. [...]]]></description>
			<content:encoded><![CDATA[<p>HTML <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> tag tells robots not to index the content of a page, and/or not scan it for links to follow, keeping this metatag for pages which we don&#8217;t want to index, nor to follow the links on the webpage is helpful.</p>
<p>In some cases, we come across situations where we keep links to external sites. But what are the impacts of this?</p>
<ol>
<li>Part of <a href="http://en.wikipedia.org/wiki/Page_rank" title="Page rank" target="_blank" rel="noindex, nofollow">page rank</a> is shared to external website -<br />
When we link to other websites, our part of our website page rank is shared to<br />
those external sites, and we may end up sending the search engine crawlers to other side.</li>
<li>Leading Search Engine Crawlers to crawl external website -<br />
Crawler entered our website to crawl more pages, it will help us to have more indexes in Search Engines, but what did we end up keeping external links, we created a way to Crawler to leave our website and crawl the external websites.</li>
</ol>
<p>We have to keep external links, but how do we prevent the above scenario -</p>
<li>If google.com is a external link, we could use &lt; a href=&#8221;http://www.google.com&#8221; rel=&#8221;noindex, nofollow&#8221; &gt; , when the crawler comes across this external link, it tells the crawler not crawl or follow that link.</li>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow/feed</wfw:commentRss>
		</item>
		<item>
		<title>ganeshhs.com google page rank</title>
		<link>http://ganeshhs.com/search-engine-optimization-seo/ganeshhscom-google-page-rank</link>
		<comments>http://ganeshhs.com/search-engine-optimization-seo/ganeshhscom-google-page-rank#comments</comments>
		<pubDate>Sat, 21 Jun 2008 17:17:06 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[Google]]></category>

		<category><![CDATA[Search Engine Optimization]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/uncategorized/ganeshhscom-google-page-rank</guid>
		<description><![CDATA[My blog site ganeshhs.com has now Google Page Rank of 2/10.

When i started first project with zend framework may 2007, there were very few articles/tutorials and my first point of getting info was using search engine, then i realised it would be a great idea if my articles list in search engine and my first [...]]]></description>
			<content:encoded><![CDATA[<p>My blog site ganeshhs.com has now<strong> Google Page Rank </strong>of <strong>2</strong>/<strong>10</strong>.<br />
<img src="http://ganeshhs.com/wp-content/uploads/ganesh-h-s-google-page-rank.gif" alt="ganesh-h-s-google-page-rank" /></p>
<p>When i started first project with zend framework may 2007, there were very few articles/tutorials and my first point of getting info was using search engine, then i realised it would be a great idea if my articles list in search engine and my first eye was on <strong>search engine optimization</strong>.</p>
<p>Looking at my website analytics i noticed that my recent posts on zend lucene search had more number of unique visits which also increased my website daily visits to average of 100 visits (with more unique visits), and also i started getting backlinks from other websites(namely <a href="http://www.phpimpact.com/" target="_blank">http://www.phpimpact.com/</a> etc.) which also contributed for this page rank.</p>
<p>More essentially keywords(relevant to the context of the website/article) helps the articles to get indexed by search engines,  following lists some of the blog articles and keywords i targeted and their stats in search engines Yahoo!/Google -</p>
<table style="border: 1px solid #000000;" cellspacing="0" cellpadding="8">
<tr >
<td style="border-bottom: 1px solid #000000;"><strong>Keyword</strong></td>
<td style="border-bottom: 1px solid #000000;"><strong>Google Position</strong></td>
<td style="border-bottom: 1px solid #000000;"><strong>Yahoo! Position</strong></td>
</tr>
<tr>
<td>Zend Lucene Search</td>
<td><a href="http://www.google.com/search?q=zend+lucene+search&amp;sourceid=navclient-ff&amp;ie=UTF-8&amp;rlz=1B3GGGL_enIN262IN262" title="Zend lucene search Google search result position" target="_blank">Page 1</a></td>
<td><a href="http://search.yahoo.com/search;_ylt=A0oGkmxwNV1IK2EAdKFXNyoA?p=Zend+Lucene+Search&amp;y=Search&amp;fr=slv1-&amp;ei=UTF-8" title="zend lucene search Yahoo! search result position" target="_blank">Page 1</a></td>
</tr>
<tr>
<td><a href="http://ganeshhs.com/zend-framework/zend-framework-tutorial-part-9-zend-auth" target="_blank">Zend Auth</a></td>
<td><a href="http://www.google.com/search?q=zend+auth&amp;sourceid=navclient-ff&amp;ie=UTF-8&amp;rlz=1B3GGGL_enIN262IN262" title="zend auth google search result position" target="_blank">Page 1</a></td>
<td><a href="http://search.yahoo.com/search?p=Zend+Auth&amp;ei=UTF-8&amp;y=Search&amp;fr=slv1-&amp;xargs=0&amp;pstart=1&amp;b=11" title="zend auth Yahoo! search result position" target="_blank">Page 2</a></td>
</tr>
<tr>
<td><a href="http://ganeshhs.com/zend-framework/zend-framework-tutorial-part-8-zend-registry" target="_blank">Zend Registry</a></td>
<td><a href="http://www.google.com/search?q=zend+registry&amp;sourceid=navclient-ff&amp;ie=UTF-8&amp;rlz=1B3GGGL_enIN262IN262" target="_blank">Page 1</a></td>
<td>-</td>
</tr>
<tr>
<td><a href="http://ganeshhs.com/zend-framework/zend-framework-tutorial-part-6-zend-debug" target="_blank">Zend Debug</a></td>
<td><a href="http://www.google.com/search?q=zend+debug&amp;sourceid=navclient-ff&amp;ie=UTF-8&amp;rlz=1B3GGGL_enIN262IN262" target="_blank">Page 1</a></td>
<td>-</td>
</tr>
<tr>
<td><a href="http://ganeshhs.com/zend-framework/zend-framework-tutorial-part-5-zend-exception" title="zend exception" target="_blank">Zend Exception</a></td>
<td><a href="http://www.google.com/search?hl=en&amp;rlz=1B3GGGL_enIN262IN262&amp;q=Zend+Exception&amp;btnG=Search" target="_blank">Page 1</a></td>
<td>-</td>
</tr>
<tr>
<td><a href="http://ganeshhs.com/zend-framework/zend-framework-tutorial-part-4-zend-config" title="zend config" target="_blank">Zend Config</a></td>
<td><a href="http://www.google.com/search?hl=en&amp;rlz=1B3GGGL_enIN262IN262&amp;q=zend+config&amp;btnG=Search" target="_blank">Page 1</a></td>
<td>-</td>
</tr>
<tr>
<td><a href="http://ganeshhs.com/zend-framework/zend-framework-tutorial-part-3-zend-loader" target="_blank">Zend Loader</a></td>
<td><a href="http://www.google.com/search?hl=en&amp;rlz=1B3GGGL_enIN262IN262&amp;q=zend+loader&amp;btnG=Search" target="_blank">Page 1</a></td>
<td>-</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/search-engine-optimization-seo/ganeshhscom-google-page-rank/feed</wfw:commentRss>
		</item>
		<item>
		<title>Zend Lucene Search - part4 - Search Results Highlighting</title>
		<link>http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting</link>
		<comments>http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting#comments</comments>
		<pubDate>Thu, 27 Mar 2008 14:44:14 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting</guid>
		<description><![CDATA[Zend_Search_Lucene_Search_Query::highlightMatches() method allows the developer to highlight HTML document terms             in the context of a search query.
In the previous article  Zend Lucene Search  - part3 - retrieving the indexed data i talked about retrieving the search results. When we search, highlighting [...]]]></description>
			<content:encoded><![CDATA[<p><code class="code">Zend_Search_Lucene_Search_Query::highlightMatches()</code> method allows the developer to highlight HTML document terms             in the context of a search query.</p>
<p>In the previous article<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" target="_blank">  </a><strong><a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" target="_blank">Zend Lucene </a></strong><a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" target="_blank"></a><strong><a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" target="_blank">Search </a></strong><strong><a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" target="_blank"> - part3 - retrieving the indexed data</a> </strong>i talked about retrieving the search results. When we search, highlighting the searched keyword in the search result is one of the important aspect which most search engines follow, in this article i will be writing about highlighting the search results retrieved using the <strong>zend lucene search</strong>.<strong><br />
</strong></p>
<pre name="code" class="php">&lt;?phprequire_once ‘Zend/Search/Lucene.php’;$queryStr= "php";

$query = Zend_Search_Lucene_Search_QueryParser::parse($queryStr);

$index = Zend_Search_Lucene::open("/var/www/lucene-data/blog-index");

$results = $index-&gt;find($query);

echo "Index contains ".$index-&gt;count()." documents.\n\n";

if($index-&gt;count())

{

$count = 0;

foreach ($results as $result)

{

$data[$count]["article_url"]         = $result-&gt;url;

$data[$count]["article_title"]        = $query-&gt;highlightMatches($result-&gt;title);

$data[$count]["article_description"]        = $query-&gt;highlightMatches($result-&gt;contents);

$data[$count]["article_created_date_time"]    = $result-&gt;postedDateTime;

$data[$count]["article_id"]             = $result-&gt;articleId;

$count++;

}

}

print_R($data);

?&gt;</pre>
<p>This program is same as in the <strong><a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data">Zend Lucene Search - part3 - retrieving the indexed data</a> </strong>only one thing differs is now i am calling  <code class="code">highlightMatches for the search results returned.</code></p>
<p><strong>Related articles:</strong><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part1" title="zend lucene search - creating index" target="_blank">Zend Lucene Search - part1 - creating index</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part2-real-time-indexing" title="zend lucene search - real time indexing" target="_blank">Zend Lucene Search - part2 - Real time indexing</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" title="zend lucene search - retrieving the index data" target="_blank">Zend Lucene Search - part3 - retrieving the indexed data</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting/feed</wfw:commentRss>
		</item>
		<item>
		<title>Zend Lucene Search - part3 - retrieving the indexed data</title>
		<link>http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data</link>
		<comments>http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data#comments</comments>
		<pubDate>Mon, 17 Mar 2008 18:40:43 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[zend framework]]></category>

		<category><![CDATA[zend-lucene]]></category>

		<category><![CDATA[zend-search-lucene]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/uncategorized/zend-search-lucene-part2-retrieving-the-index-data</guid>
		<description><![CDATA[Once the index is created, we are ready use zend lucene search to search the website. In the following example, php  is the search keyword used to fetch the relevant search results in the already indexed data.

&#60;?php

require_once ‘Zend/Search/Lucene.php’;$query = "php";

$index = Zend_Search_Lucene::open("/var/www/lucene-data/blog-index");

$results = $index-&#62;find($query);

echo "Index contains ".$index-&#62;count()." documents.\n\n";

if($index-&#62;count())

{

$count = 0;

foreach ($results as $result)

{

$data[$count]["article_url"]  [...]]]></description>
			<content:encoded><![CDATA[<p>Once the index is created, we are ready use <strong>zend lucene search</strong> to search the website. In the following example, php  is the search keyword used to fetch the relevant search results in the already indexed data.</p>
<pre name="code" class="php">
&lt;?php

require_once ‘Zend/Search/Lucene.php’;$query = "php";

$index = Zend_Search_Lucene::open("/var/www/lucene-data/blog-index");

$results = $index-&gt;find($query);

echo "Index contains ".$index-&gt;count()." documents.\n\n";

if($index-&gt;count())

{

$count = 0;

foreach ($results as $result)

{

$data[$count]["article_url"]         = $result-&gt;url;

$data[$count]["article_title"]        = $query-&gt;highlightMatches($result-&gt;title);

$data[$count]["article_description"]        = $query-&gt;highlightMatches($result-&gt;contents);

$data[$count]["article_created_date_time"]    = $result-&gt;postedDateTime;

$data[$count]["article_id"]             = $result-&gt;articleId;

$count++;

}

}

print_R($data);

?&gt;</pre>
<p>To retrieve the index data, first thing we need to do is to open the indexed path.</p>
<pre name="code" class="php">$index = Zend_Search_Lucene::open("/var/www/lucene-data/blog-index");</pre>
<p>Suppose if user search input is -</p>
<pre name="code" class="php">$query = "php";</pre>
<p>We have to use the find method of zend search lucene -</p>
<pre name="code" class="php">$results = $index-&gt;find($query);</pre>
<p>To retrieve the total records resulted in the search result, we have to use count method of <strong>zend lucene search</strong> -</p>
<pre name="code" class="php">echo "Index contains ".$index-&gt;count()." documents.\n\n";</pre>
<p>To limit the search result count we have to use setResultSetLimit of <strong>zend  lucene search</strong> -</p>
<pre name="code" class="php">$index-&gt;setResultSetLimit(10);</pre>
<p><strong>Related articles:</strong><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part1" title="zend lucene search - creating index" target="_blank">Zend Lucene Search - part1 - creating index</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part2-real-time-indexing" title="zend lucene search - real time indexing" target="_blank">Zend Lucene Search - part2 - Real time indexing</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting" title="zend lucene search - search results highlighting" target="_blank">Zend Lucene Search - part4 - Search Results Highlighting</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data/feed</wfw:commentRss>
		</item>
		<item>
		<title>Zend Lucene Search - part2 - Real time indexing</title>
		<link>http://ganeshhs.com/zend-framework/zend-search-lucene-part2-real-time-indexing</link>
		<comments>http://ganeshhs.com/zend-framework/zend-search-lucene-part2-real-time-indexing#comments</comments>
		<pubDate>Mon, 17 Mar 2008 18:23:02 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/uncategorized/zend-search-lucene-part2-real-time-indexing</guid>
		<description><![CDATA[For creating the index from the existing data, we need to create the index. Isn&#8217;t it a better idea to index each data when its created, to index the real time data we need to open the index which was created earlier, rest of the other things remains same as discussed in the Zend lucene [...]]]></description>
			<content:encoded><![CDATA[<p>For creating the index from the existing data, we need to create the index. Isn&#8217;t it a better idea to index each data when its created, to index the real time data we need to open the index which was created earlier, rest of the other things remains same as discussed in the <a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part1">Zend lucene Search - part1</a>.</p>
<pre name="code" class="php"> &lt;?phprequire_once 'Zend/Search/Lucene.php';$index = Zend_Search_Lucene::open("/var/www/lucene-data/blog-index");

$doc = new Zend_Search_Lucene_Document();

$doc-&gt;addField(Zend_Search_Lucene_Field::Keyword('url',

"http://ganeshhs.com/url-3"));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('articleId',

3));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('postedDateTime',

"20007-12-29 01:40:00"));

$doc-&gt;addField(Zend_Search_Lucene_Field::Text('title',

"Porting PHP to Javascript : php js"));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnStored('contents',

"During graduation got interested in web technology, to kick start i started reading html, javascript."));

$doc-&gt;addField(Zend_Search_Lucene_Field::Text('category',

"Javascript"));

$index-&gt;addDocument($doc);

$index-&gt;commit();

$index-&gt;optimize();</pre>
<p><strong>Related articles:</strong><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part1" title="zend lucene search - creating index" target="_blank">Zend Lucene Search - part1 - creating index</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" title="zend lucene search - retrieving the index data" target="_blank">Zend Lucene Search - part3 - retrieving the indexed data</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting" title="zend lucene search - search results highlighting" target="_blank">Zend Lucene Search - part4 - Search Results Highlighting</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/zend-framework/zend-search-lucene-part2-real-time-indexing/feed</wfw:commentRss>
		</item>
		<item>
		<title>Zend Lucene Search - part1 - creating index</title>
		<link>http://ganeshhs.com/zend-framework/zend-search-lucene-part1</link>
		<comments>http://ganeshhs.com/zend-framework/zend-search-lucene-part1#comments</comments>
		<pubDate>Mon, 17 Mar 2008 17:43:38 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/uncategorized/zend-search-lucene-part1</guid>
		<description><![CDATA[In this article i will be discussing about creating index using zend lucene search .
Conventionally most of the site search are powered by database driven.
Lets consider my blog site, if anyone comes to my site and wants to search for any keyword, if i have to give search results i may have to look into [...]]]></description>
			<content:encoded><![CDATA[<p>In this article i will be discussing about creating index using <strong>zend lucene search</strong> .</p>
<p>Conventionally most of the site search are powered by database driven.</p>
<p>Lets consider my blog site, if anyone comes to my site and wants to search for any keyword, if i have to give search results i may have to look into articles table, comments table, executing SQL queries against 2 tables is acceptable, but if we go to any e-commerce application, we may have to search against lot of categories and products, since database queries are costlier, it consumes more resources. One more important point is we cannot get more relevant results first, in general we cannot rank the search results.</p>
<p><a href="http://lucene.apache.org/java/docs/" target="_blank">Apache Lucene</a> is a high-performance, full-featured text search engine library written entirely in Java. This is being used in most of web2.0 websites.  Zend_Search_Lucene was derived from the Apache Lucene project.</p>
<pre name="code" class="php">&lt;?php//Index the blog articles

require_once 'Zend/Search/Lucene.php';

$articlesData =    array (0 =&gt; array( "url"           =&gt; "http://ganeshhs.com/url-1",

"title"	     =&gt; "Google suggest : pick right search keyword",

"contents"	 =&gt; "Picking the right keywords for the websites is the success of search engine marketing. When i started search engine optimization, i used to use overture keyword selector tool and check the search counts what other users have searched. "

"category"	     =&gt; "Google",

"postedDateTime" =&gt; "2007-12-26 12:20:00",

"articleId"            	     =&gt; 1),

1 =&gt; array( "url"           =&gt; "http://ganeshhs.com/url-2",

"title"	     =&gt; "zend framework tutorial | part 9 Zend Auth",

"contents"	 =&gt; "Zend Auth is easy to set up and provides a system that secures our site with an easy to use  authentication mechanism. Zend Auth(Zend_Auth) provides an API for authentication. "

"category"	     =&gt; "zend-framework",

"postedDateTime" =&gt; "2007-12-26 12:20:00",

"articleId"	     =&gt; 2));

if(is_array($articlesData) &amp;&amp; count($articlesData))

{

$index = Zend_Search_Lucene::create('/var/www/lucene-data/blog-index');

foreach($articlesData as $articleData)

{

$doc = new Zend_Search_Lucene_Document();

$doc-&gt;addField(Zend_Search_Lucene_Field::Keyword('url',

$articleData["url"]));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('articleId',

$articleData["articleId"]));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('postedDateTime',

$articleData["postedDateTime"]));

$doc-&gt;addField(Zend_Search_Lucene_Field::Text('title',

$articleData["title"]));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnStored('contents',

$articleData["contents"]));

$doc-&gt;addField(Zend_Search_Lucene_Field::Text('category',

$articleData["category"]));

echo "

Adding: ". $articleData["title"] ."\n";

$index-&gt;addDocument($doc);

}

$index-&gt;commit();

$index-&gt;optimize();

}

?&gt;</pre>
<p>$index = Zend_Search_Lucene::create(’/var/www/lucene-data/blog-index’);<br />
Specifies the path of zend lucene index where the documents will be store.</p>
<p>For each iteration, we are creating a document-</p>
<pre name="code" class="php">$doc = new Zend_Search_Lucene_Document();</pre>
<p>Once the document is created we need to add the fields and contents to the document -</p>
<p>Here since the <em>URL</em> is unique to the article we are indexing it as a <em>Keyword field type</em>.</p>
<p>we may need blog <em>article id</em> and blog <em>create date time</em> in the display part, it wont be used for search so we are storing it as <em>UnIndexed field type</em>.</p>
<p><em>Title</em> is stored as text field type.</p>
<p><em>Content/Description</em> is indexed but not stored in index. Because description occupies more space and creates a larger index on disk, so if we need to search but not redisplay the data,  <em>UnStored field type</em> is preferred.</p>
<pre name="code" class="php">$doc-&gt;addField(Zend_Search_Lucene_Field::Keyword(’url’,

$articleData[”url”]));$doc-&gt;addField(Zend_Search_Lucene_Field::UnIndexed(’articleId’,

$articleData[”articleId”]));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnIndexed(’postedDateTime’,

$articleData[”postedDateTime”]));

$doc-&gt;addField(Zend_Search_Lucene_Field::Text(’title’,

$articleData[”title”]));

$doc-&gt;addField(Zend_Search_Lucene_Field::UnStored(’contents’,

$articleData[”contents”]));

$doc-&gt;addField(Zend_Search_Lucene_Field::Text(’category’,

$articleData[”category”]));</pre>
<p>Once the document is created and fields are added we need to add the document to the index -</p>
<pre name="code" class="php">$index-&gt;addDocument($doc);</pre>
<p>After all the iterations we can commit the index-</p>
<pre name="code" class="php">$index-&gt;commit();</pre>
<p>Following command is used to optimize the index -</p>
<pre name="code" class="php">$index-&gt;optimize();</pre>
<p><strong>Understanding Field Types -</strong></p>
<li><em>Keyword fields</em> are stored and indexed, meaning that they can be searched as well as displayed in search results. They are not split up into separate words by tokenization. Enumerated database fields usually translate well to Keyword fields in Zend_Search_Lucene.</li>
<li><em>UnIndexed fields</em> are not searchable, but they are returned with search hits. Database timestamps, primary keys, file system paths, and other external identifiers are good candidates for UnIndexed fields</li>
<li><em>Binary fields</em> are not tokenized or indexed, but are stored for retrieval with search hits. They can be used to store any data encoded as a binary string, such as an image icon.</li>
<li><em>Text fields</em> are stored, indexed, and tokenized. Text fields are appropriate for storing information like subjects and titles that need to be searchable as well as returned with search results.</li>
<li><em>UnStored fields </em>are tokenized and indexed, but not stored in the index. Large amounts of text are best indexed using this type of field. Storing data creates a larger index on disk, so if you need to search but not redisplay the data, use an UnStored field. UnStored fields are practical when using a Zend_Search_Lucene index in combination with a relational database. You can index large data fields with UnStored fields for searching, and retrieve them from your relational database by using a separate field as an identifier.</li>
<table>
<tr>
<td><strong>Field Type</strong></td>
<td><strong>Stored</strong></td>
<td><strong>Indexed</strong></td>
<td><strong>Tokenized</strong></td>
<td><strong>Binary</strong></td>
</tr>
<tr>
<td>Keyword</td>
<td>yes</td>
<td>yes</td>
<td>no</td>
<td>no</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>UnIndexed</td>
<td>yes</td>
<td>no</td>
<td>no</td>
<td>no</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Binary</td>
<td>yes</td>
<td>no</td>
<td>no</td>
<td>yes</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Text</td>
<td>yes</td>
<td>yes</td>
<td>yes</td>
<td>no</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>UnStored</td>
<td>no</td>
<td>yes</td>
<td>yes</td>
<td>no</td>
<td>&nbsp;</td>
</tr>
</table>
<p><strong>Related articles:</strong><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part2-real-time-indexing" title="zend lucene search - real time indexing" target="_blank">Zend Lucene Search - part2 - Real time indexing</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part3-retrieving-the-index-data" title="zend lucene search - retrieving the index data" target="_blank">Zend Lucene Search - part3 - retrieving the indexed data</a><br />
<a href="http://ganeshhs.com/zend-framework/zend-search-lucene-part4-search-results-highlighting" title="zend lucene search - search results highlighting" target="_blank">Zend Lucene Search - part4 - Search Results Highlighting</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/zend-framework/zend-search-lucene-part1/feed</wfw:commentRss>
		</item>
		<item>
		<title>Google experiment</title>
		<link>http://ganeshhs.com/web-crunch/google-experiment</link>
		<comments>http://ganeshhs.com/web-crunch/google-experiment#comments</comments>
		<pubDate>Tue, 12 Feb 2008 17:33:18 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[Google]]></category>

		<category><![CDATA[web crunch]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/web-crunch/google-experiment</guid>
		<description><![CDATA[Google and yahoo always comes up with innovative ideas. Yahoo&#8217;s YSlow is one of such innovative idea which helps us many web developers to improvise the performance of the website.
Recently came across a article about Google experiment, its a experiment any user can take, its aimed at improving the search experience.
Experiments allows us to join [...]]]></description>
			<content:encoded><![CDATA[<p>Google and yahoo always comes up with innovative ideas. Yahoo&#8217;s <a href="http://developer.yahoo.com/yslow/" target="_blank"><strong>YSlow</strong></a> is one of such innovative idea which helps us many web developers to improvise the performance of the website.</p>
<p>Recently came across a article about <a href="http://www.google.com/experimental/" target="_blank"><strong>Google experiment</strong></a>, its a experiment any user can take, its aimed at improving the search experience.</p>
<p>Experiments allows us to join any one of following experiment at a time -</p>
<ol>
<li>Alternate views for search results.</li>
<li>Keyword suggestions.</li>
<li>Keyboard shortcuts.</li>
<li>Left-hand search navigation.</li>
<li>Right-hand contextual search navigation.</li>
</ol>
<p>This experiment with keyword suggestions is same as google suggest, i preferred taking that as my first experiment.</p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/web-crunch/google-experiment/feed</wfw:commentRss>
		</item>
		<item>
		<title>Porting PHP to Javascript : php js</title>
		<link>http://ganeshhs.com/php/porting-php-to-javascript-php-js</link>
		<comments>http://ganeshhs.com/php/porting-php-to-javascript-php-js#comments</comments>
		<pubDate>Tue, 12 Feb 2008 17:10:05 +0000</pubDate>
		<dc:creator>Ganesh H S , Bangalore, India</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ganeshhs.com/php/porting-php-to-javascript-php-js</guid>
		<description><![CDATA[During graduation got interested in web technology, to kick start i started reading html, javascript.
But when i started my career i was bit disappointed when i realised javascript won&#8217;t work if the javascript is disabled in the browser, so my senior in first company suggested me to always do server side validation using php.
But  [...]]]></description>
			<content:encoded><![CDATA[<p>During graduation got interested in web technology, to kick start i started reading html, <strong>javascript</strong>.</p>
<p>But when i started my career i was bit disappointed when i realised javascript won&#8217;t work if the javascript is disabled in the browser, so my senior in first company suggested me to always do server side validation using <strong>php</strong>.</p>
<p>But  things changed rapidly, in the current firm we use lot of javascript/ajax applications, according to many surveys of most internet users do use javascript enabled browser.</p>
<p>Smarty is pretty interesting concept to bring liveliness to the static html, where we do dynamic programming in templates. Sometimes i always felt its always better if smarty has functions similar to php, and register_modifier opens up that option where we register php functions that are not available in smarty.</p>
<p>Having server side validation with client side validation is better approach, even the web tech giants like yahoo and google does the same, if you want to notice then try disabling javascript in your browser and open gmail.com or mail.yahoo.com it shows the basic edition of mail.</p>
<p>Well sometimes i came across writting few functions similar to <strong>PHP </strong>for email validation and URL validation. I always thought why can&#8217;t we use PHP in Javascript as much similar finding dynamic behavior in HTML(smarty and other template engines provides that), here is a <strong><a href="http://kevin.vanzonneveld.net/techblog/article/phpjs_licensing/" target="_blank">PHP JS</a></strong>  which does the same, its a project aimed porting PHP to <strong>Javascript</strong>. It has lot of PHP functions being ported to <strong>Javascript </strong>version.</p>
]]></content:encoded>
			<wfw:commentRss>http://ganeshhs.com/php/porting-php-to-javascript-php-js/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
