<?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>Lijeesh Blog &#187; Research</title>
	<atom:link href="http://lijeeshms.com/tag/research/feed" rel="self" type="application/rss+xml" />
	<link>http://lijeeshms.com</link>
	<description>It is the matter of freedom</description>
	<lastBuildDate>Wed, 28 Apr 2010 10:07:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Setting up a development Sphinx search engine in Mac OS</title>
		<link>http://lijeeshms.com/2010/01/11/setting-up-a-development-sphinx-search-engine-in-mac-os.html</link>
		<comments>http://lijeeshms.com/2010/01/11/setting-up-a-development-sphinx-search-engine-in-mac-os.html#comments</comments>
		<pubDate>Mon, 11 Jan 2010 08:24:16 +0000</pubDate>
		<dc:creator>Lijeesh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://lijeeshms.com/?p=267</guid>
		<description><![CDATA[Sphinx is one of the high performance, free open-source full-text search engine with rich feature list. Recently I was experimenting, on this tool for developing a search platform, for big and complex databases. It is very interesting, and easy to setup a developing environment in Mac OS. Sometimes the compiling using the method specified in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sphinxsearch.com/" target="_blank">Sphinx</a> is one of the high performance, free open-source full-text search engine with rich feature list. Recently I was experimenting, on this tool for developing a search platform, for big and complex databases.  It is very interesting, and easy to setup a developing environment in Mac OS. Sometimes the compiling using the method specified in the <a href="http://www.sphinxsearch.com/docs/manual-0.9.9.html" target="_blank"> documents of sphinx</a> will not work that easily. I found it is super easy, installation using mac ports. Here is how I done it.</p>
<h3>Installing Sphinx using Mac Ports </h3>
<p>1. If you don&#8217;t have mac-ports installed, Install <a href="http://www.macports.org/" target="_blank">mac-ports downloading from their site</a>.<br />
2. If you not installed X code tools from Mac OS X, DVD install it &#8211; need this for compiling sources in a UNIX development way.<br />
3. Now install sphinx using following command.
<pre class="brush: plain;">sudo port install sphinx</pre>
<p> This will compile and install everything required for making the sphinx work.</p>
<p>Now sphinx is installed and we have &#8216;indexer&#8217;, &#8216;search&#8217; utilities and a &#8216;searchd&#8217; daemon. </p>
<h3>Basic way to use Sphinx</h3>
<p>Sphinx comes with a sample sql file to setup a sql-query based search (Simplest configuration). This SQL and a sample Sphinx sample configuration is located at
<pre class="brush: plain;">/opt/local/etc/sphinx</pre>
<p>. Try following steps to make it running with your configuration<br />
1. Create a directory some where in your system. In my case I created at desktop named &#8216;sphinx&#8217;.
<pre class="brush: plain;"> cd ~/Desktop/sphinx </pre>
<p>2. Create &#8216;test&#8217; database in your mysql server and import the Sample SQL.<br />
2. copy sphinx.conf from sample /opt/local/etc/sphinx to this folder.
<pre class="brush: plain;">cp /opt/local/etc/sphinx/sphinx.conf.dist sphinx.conf</pre>
<p>3. Now edit sphinx.conf and change the database Params and paths. In my case it looks like following. Edit the queries related to your custom databases to make it yours.</p>
<pre class="brush: plain;">
source src1
{
	type					= mysql

	sql_host				= localhost
	sql_user				= test
	sql_pass				=
	sql_db					= test
	sql_port				= 3306	# optional, default is 3306

	sql_query				= \
		SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content \
		FROM documents

	sql_attr_uint			= group_id
	sql_attr_timestamp		= date_added

	sql_query_info			= SELECT * FROM documents WHERE id=$id
}

index test1
{
	source					= src1
	path					= /Users/lijeeshms/Desktop/sphinx/data/test1
	docinfo					= extern
	charset_type			= sbcs
}

indexer
{
	mem_limit				= 32M
}

searchd
{
	port					= 3312
	log						= /Users/lijeeshms/Desktop/sphinx/log/searchd.log
	query_log				= /Users/lijeeshms/Desktop/sphinx/log/query.log
	read_timeout			= 5
	max_children			= 30
	pid_file				= /Users/lijeeshms/Desktop/sphinx/log/searchd.pid
	max_matches				= 1000
	seamless_rotate			= 1
	preopen_indexes			= 0
	unlink_old				= 1
}
</pre>
<p>4. Create 2 folders, &#8216;data&#8217; and &#8216;log&#8217; inside the &#8216;sphinx&#8217; directory.
<pre class="brush: plain;">mkdir data log</pre>
<p>5. Now run the indexer with the configuration we created from the test directory.
<pre class="brush: plain;">indexer --config /&lt;path-to&gt;/sphinx.conf --all</pre>
<p> This will create the indexes based the confutation.<br />
6. Now run the Sphinx search daemon using the same command.
<pre class="brush: plain;">searchd --config /&lt;path-to&gt;/sphinx.conf </pre>
<p> If everything is fine, sphinx search engine will start with the above index configurations. If any error happens you need to check the configuration for any errors.<br />
7. You can now test a search with &#8216;search&#8217; command from terminal.
<pre class="brush: plain;">search &lt;query&gt; </pre>
<p> The results will be shown.</p>
<p>Once all the above is working, it will be easy to use any of the client libraries for PHP (or <a href="http://php.net/sphinx" target="_blank">PECL</a>), Python, Ruby or Java to search from a web or desktop based environments. Sphinx provides options to run multiple indexes and search on selected indexes, thus allowing one daemon to use with multiple type of searches.<br />
Sphinx can index data from an XMLPipe, this is best for creating configurable search indexes from very dynamic datasources like a CMS or CRM.</p>
]]></content:encoded>
			<wfw:commentRss>http://lijeeshms.com/2010/01/11/setting-up-a-development-sphinx-search-engine-in-mac-os.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->