preload
Jan 11

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 the documents of sphinx will not work that easily. I found it is super easy, installation using mac ports. Here is how I done it.

Installing Sphinx using Mac Ports

1. If you don’t have mac-ports installed, Install mac-ports downloading from their site.
2. If you not installed X code tools from Mac OS X, DVD install it – need this for compiling sources in a UNIX development way.
3. Now install sphinx using following command.

sudo port install sphinx

This will compile and install everything required for making the sphinx work.

Now sphinx is installed and we have ‘indexer’, ’search’ utilities and a ’searchd’ daemon.

Basic way to use Sphinx

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

/opt/local/etc/sphinx

. Try following steps to make it running with your configuration
1. Create a directory some where in your system. In my case I created at desktop named ’sphinx’.

 cd ~/Desktop/sphinx 

2. Create ‘test’ database in your mysql server and import the Sample SQL.
2. copy sphinx.conf from sample /opt/local/etc/sphinx to this folder.

cp /opt/local/etc/sphinx/sphinx.conf.dist sphinx.conf

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.

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
}

4. Create 2 folders, ‘data’ and ‘log’ inside the ’sphinx’ directory.

mkdir data log

5. Now run the indexer with the configuration we created from the test directory.

indexer --config /<path-to>/sphinx.conf --all

This will create the indexes based the confutation.
6. Now run the Sphinx search daemon using the same command.

searchd --config /<path-to>/sphinx.conf 

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.
7. You can now test a search with ’search’ command from terminal.

search <query> 

The results will be shown.

Once all the above is working, it will be easy to use any of the client libraries for PHP (or PECL), 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.
Sphinx can index data from an XMLPipe, this is best for creating configurable search indexes from very dynamic datasources like a CMS or CRM.

Tagged with:
Oct 01

After updating to my Macbook to snow leapard  I was facing serious performance issues. Sometimes it even slows down the entire system. I tried reinstalling the newest version. Still problems didnt go away. There is still no firefox intel 64 build for snowleapard yet.

I find out Shiretoko recently it works amazing,

Shiretoko Firefox Mac

Shiretoko Firefox Mac

Download it here

Tagged with:
Oct 01

Mac ports is the way to use most of the opens source software from the community on Macs. Recently I found out new tool named Porticus, that makes the life so easy.

Porticus for Macports

Porticus for Macports

Setting up Porticus for the first time – snow leapard

1) Install macports, downloading the dmg – checkout Macports website for updates

2) Install Porticus downloading from  Porticus website

That is it. It is realy usefull tool to try free software on mac. Feels like one of the software package management GUIs Linux users enjoy

Tagged with:
Jun 09

Apple updated in MAC OSX with new release, Snow Leopard – The most powerful Operating system for Macs yet. They updated iPhone with new iPhone 3GS and updated Macbook Pro. Best thing is prices are reduced and power and features are increased. These news are announced yesterday night at WWDC keynote presentation. Apple fans are always curious about any new from the company. In Dubai we all are at WWDC Get-Together event organized by shuffle Magazine ( twitter – @shufflegazine), to track the event live.

We are watching the event live at www.macrumors.com and Engadget live blogs. We discussed and enjoyed the new updates.

here is some photos from the event

WWDC Get together in Dubai

WWDC Get together in Dubai

WWDC Get Together in Dubai by shuffle magazine

WWDC Get Together in Dubai by shuffle magazine

Shuja in WWDC get Together

Shuja in WWDC get Together

Me in WWDC get Togeher in Dubai

Me in WWDC get Togeher in Dubai

Lucky Draw at WWDC Get Together

Lucky Draw at WWDC Get Together




More images can be found in Shuffle magazine Facebook album

Tagged with:
Mar 28

Finally after more than one year, I updated my blog. Unfortunately may be due to  a lazy digital life style, I forgot my blog for a while :)

I started thinking about updating my blog after  Shuja posted his long awaited blog post entry, struggling to blog.

When Ambarish started his blog, he asked me some help on setting up. He linked my blog on his blog. This also gave me more strength to update my blog.

From Flip Trivandrum most the guys started blogging. And Muhammed shameer blogged about the Flip Trivandrum bloggers. All started twittering, and Saifudeen said twitter is for lazy bloggers.  All these new happenings  made me update my blog again for new start.

Updates

  1. Blog theme is updated with the iBlog theme by Andrew Powers and Pagelines Design, inspired by Apple – also in these days I switched to mac from Linux, will update about this in upcomming posts :) .
  2. Edited the theme to make it work with my Open id authentication – my blog URL is my Open ID. Added my “photoblog” page back in, by a small hack
  3. Added plugin  All in One SEO Pack .
  4. Added Lightbox Plus plugin to make my old lightbox stuffs work.- There exists lot of amazing alternatives for lightbox these days will updates with similar one later.

Since my wordpress installation was a bit older some existing plugins made problems while updating to latest. With wordpress plugin autoinstall features everything went very easy.

Tagged with: