Tuesday, December 11, 2012

Sphinx Installation on windows

1)      Downloade sphinx from http://sphinxsearch.com/downloads/release/

2)      Extract the zip file to c:\sphinx folder. You can find a file named searchd.exe file in c:\sphinx\bin\ folder. 

3)     To install searchd.exe from command prompt follow the steps.

·         Startàtype ‘cmd’ in the search box. Now shows cmd.exe in the program list right click on it select run as administrator. Please note select run as administrator is very important other vise it will show some errors. Now type

                 ·         C:\Sphinx\bin\searchd --install –config C:\Sphinx\sphinx.conf.in -- servicename SphinxSearch

4)    Now you are successfully installed and configured  sphinx Searchd service.If you are check services in your control panel you can see the newly installed services there

5)      It is now need to create an indexer for sphinx. We can create an indexer in following steps
Copy the following code to a file and save it as project.conf in c:\sphinx\

source src1
            type                             = mysql
            sql_host                       = localhost
            sql_user                       = Root
            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                             = C:\sphinx\data\test1
            docinfo                                    = extern
            charset_type                = sbcs
index testrt
            type                             = rt
            rt_mem_limit               = 32M
            path                             = C:\sphinx\data\testrt
            charset_type                = utf-8

            rt_field                        = title
            rt_field                        = content
            rt_attr_uint                  = gid
            mem_limit                   = 32M
            listen                            = 9312
            listen                            = 9306:mysql41
            log                               = C:\sphinx\log\searchd.log
            query_log                    = C:\sphinx\log\query.log
            read_timeout               = 5
            max_children              = 30
            pid_file                        = C:\sphinx\log\searchd.pid
            max_matches              = 1000
            seamless_rotate                       = 0
            preopen_indexes                     = 1
            unlink_old                   = 1
            workers                                   = threads # for RT to work
            binlog_path                 = C:\sphinx\data

6)    Create two folders data and log inside c:\sphinx\

7)      Create a bat file named sphinx_install.bat and copy the following code to it.

                 ------------------------START FILE-------------------------

                          C:\sphinx\bin\indexer.exe --config C:\sphinx\project.conf test


                          C:\sphinx\bin\searchd.exe --install --config C:\sphinx\project.conf --servicename ProjectSearch


-               -------------------------END FILE---------------------------

     8)    Create a database test and run the queries in the example.sql file.

     9)   Run the bat file

    10) Open  http://www.coreseek.cn/news/10/99/ (This is a Chinese  site open in google chrome and translate to English) Download the patch file of SphinxSE for your version of mysql.

    11)      Extract the file and copy the .dll file to mysql/lib/plugin

    12)      Run the .dll file as

                  INSTALL PLUGIN sphinx SONAME ‘ha_sphinx.dll’;

      From command promt

    13)     Mysql>show engines; run this command from mysql console. If it lists spinix in it you are successfully installed sphinx. 



Post a Comment

Powered by Blogger