Windows installation Sphinx

Source: Internet
Author: User

1. Download the 32-bit version in http://sphinxsearch.com/downloads/release/(first try the next 64-bit version, run Searchd error, do not know how to solve, 32-bit version of the error).

2. Unzip the package. Copy sphinx-min.conf.in a copy and rename it to Sphinx.conf, and create a new two folder, data and log, respectively

3.sphinx.conf inside the configuration parameters to be changed in the following places (according to their own environment to modify):

# # Minimal Sphinx Configuration sample (clean, simple, functional) #source src1{type=MySQL sql_host=localhost sql_user= test sql_pass=1234sql_db=Test Sql_port=3306# optional, default is3306Sql_query=SELECTID, group_id, Unix_timestamp (date_added) as date_added, title, content from documents Sql_attr_uint 
    =group_id Sql_attr_timestamp=date_added}index test1{Source=Src1 Path=d:/program/sphinx-2.2.6-release-win32/data/}#index testrt#{# type = rt# Rt_mem_limit = 128m## Path = @[email protected]/data/testrt## Rt_field = title # Rt_field = content# Rt_attr_uint = gid#}indexer{mem_limit=128m}searchd{Listen=9312Listen=9306: mysql41 Log=d:/program/sphinx-2.2.6-release-win32/log/ searchd.log query_log=d:/program/sphinx-2.2.6-release-win32/log/ query.log read_timeout=5Max_children= -Pid_file=d:/program/sphinx-2.2.6-release-win32/log/ searchd.pid seamless_rotate=1preopen_indexes=1Unlink_old=1Workers= Threads # forRT to work Binlog_path=d:/program/sphinx-2.2.6-release-win32/data/}

4. You can import the Example.sql from the Sphinx compressed package into local MySQL for testing:

>mysql-utest-p Test < Example.sql

5. Under the command line switch to the root directory of Sphinx, execute the following command to index:

>bin\indexer.exe test1

6. Execute the following command to establish the search service:

>SC Delete Searchd

>bin\searchd.exe--install--config d:/program/sphinx-2.2.6-release-win32/sphinx.conf

7. Use sphinxapi.php to test and create a new PHP test file under the Web directory:

<? PHP require (' sphinxapi.php '); $s=new  sphinxclient (); $s->setserver (' localhost ', ' 9312 '); $result=$s->query (' Test ', ' test1 '); Echo ' <pre> '; Print_r ($result); Echo ' </pre> ';? >

The following is the browser output:

Array([ERROR]=[WARNING]=[status]= 0[Fields]=Array        (            [0] = =Title [1] = =content) [Attrs]=Array([group_id]= 1[date_added]= 2) [matches]=Array        (            [1] = =Array([weight]= 2421[Attrs]=Array([group_id]= 1[date_added]= 1419180445                        )                )            [2] = =Array([weight]= 2421[Attrs]=Array([group_id]= 1[date_added]= 1419180445                        )                )            [4] = =Array([weight]= 1442[Attrs]=Array([group_id]= 2[date_added]= 1419180445)) ) [Total]= 3[Total_found]= 3    [ Time] = 0.000[Words]=Array([test]=Array([docs]= 3[hits]= 5                )        ))

Windows installation Sphinx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.