Articles

Umesh

Umesh's Articles

Umesh

Umesh

April 16 2013

Sphinxsearch + Anahita - Part 1

We have been discussing search for last few months and search is going to be a key functionality in Anahita 3.0

As of now (April 203), I do not have enough of technical details of search functionality in Anahita 3.0 and I've not tried testing code from search branch either.

However as I wanted to learn more about Sphinx and possible integration with Anahita, I've decided to try it out.

Background My setup is 256MB Ubuntu 10.04.4 LTS cloud server on Rackspace. Anahita setup includes approx. 5000 entries in anahita_nodes table (2000 pages + 200 users + posts/comments)

Installation Ubuntu magic-wand 'apt-get' does most of the work for you for installation. Simply type 'sudo apt-get install sphinxsearch' on command prompt and Ubuntu does rest of the work for you. In case if you find any file not found error, simply type' sudo apt-get update' and retry 'sudo apt-get install sphinxsearch'  command.

Configuration Post installation, locate sphinx.conf.dist file in /etc/sphinxsearch folder. Make a copy as sphinx.conf

Update following variables in sphinx.conf file

Provide your db details in sql_host, sql_user, sql_pass, sql_db attributes

update sql_query attribute as 

 sql_query                               = \                SELECT id, name,alias,excerpt,body, UNIX_TIMESTAMP(created_on) AS date_added \                FROM jos_nodes where enabled=1

update sql_attr_uint as

sql_attr_uint                   = id  update sql_query_info as     sql_query_info          = SELECT id,name,type FROM jos_nodes WHERE id=$id

With these changes, you are ready to perform basic tests.

 Build index with either 'sudo indexer test1' or 'sudo indexer --all'

Testing You can now perform basic search as

1. simple search > search keyword 

 2. Match exact phrase > search -p keyword1 keyword2

Observations First impression - sphinxsearch is much faster as compared to MYSQL search. I've observed CPU utilization exceeding 60-70% while executing 'LIKE' queries in MYSQL. With sphinxsearch, CPU utilization never exceeded 1% for similar searches.

These are obviously mere observations and should not be considered as scientific results. 

Next Steps As I'm through with basic setup, I'm planning to perform few more tests using search demon and fine tune indexing option. More about this in next Post

#SphinxSearch

3 people liked this
@ugawade now does anahita integrated with sphinxsearch as a plugin?or not!

Additional Information

Powered by Anahita