Centos5.5 install sphinx full-text search

Source: Internet
Author: User
Tags localhost mysql

1. download the latest version of sphinx.
Http://www.sphinxsearch.com/downloads.html

2. Installation
# Tar-zxvf sphinx-0.9.9.tar.gz
# Cd sph1_- 0.9.9/
#
. /Configure -- prefix =/usr/local/sphdes -- With-mysql-related des =/usr/local/MySQL/include/MySQL/-- With-mysql-libs =/usr/local /MySQL/lib/MySQL -- With-iconv
# Make & make install

 

../Depcomp: line 512: Exec: G ++: not found
Make [2]: *** [my_new.o] Error 127
Make [2]: Leaving directory '/tmp/lamp/mysql-5.0.56/mysys'
Make [1]: *** [All-recursive] Error 1
Make [1]: Leaving directory '/tmp/lamp/mysql-5.0.56'
Make: *** [all] Error 2
[Root @ localhost mysql-5.0.56] # solution: Yum install-y gcc-C ++


3. Configuration
# Cd/usr/local/sphinx/etc
# Cp sphinx-min.conf.dist joomla. conf
# Vi joomla. conf

#
# Minimal sphinx configuration sample (clean, simple, functional)
#


Source joomla_src
{

Type
= MySQL


SQL _host
= Localhost

SQL _user
= Root

SQL _pass
= 123456

SQL _db
= Joomla

SQL _port
= 3306
# Optional, default is 3306


SQL _query
= Select * From jos_content


SQL _attr_uint
= ID

SQL _attr_timestamp
= Created


SQL _query_info
= Select * From jos_content where id = $ ID
}

Index joomla_index
{

Source
= Joomla_src

Path
=/Usr/local/sphexample/var/data/joomla_index

Docinfo
= Extern

Charset_type
= UTF-8
}

Indexer
{

Mem_limit
= 32 m
}

Searchd
{

Port
= 9312

Log
=/Usr/local/sphinx/var/log/searchd. Log

Query_log
=/Usr/local/sphinx/var/log/query. Log

Read_timeout
= 5

Max_children
= 30

Pid_file
=/Usr/local/sphinx/var/log/searchd. PID

Max_matches
= 1000

Seamless_rotate
= 1

Preopen_indexes
= 0

Unlink_old
= 1
}

Save and exit

4. Create an index
#/Usr/local/sphinx/bin/Indexer
-- Config joomla. conf
-- All joomla_index

5. Start the sphsf-backend Service
#/Usr/local/sphinx/bin/searchd-C/usr/local/sphinx/etc/joomla. conf
-I joomla_index &

6. Test
#/Usr/local/PHP/bin/PHP-CGI test. php-H localhost-P 9312-I joomla_index-pH title
X-powered-by: PHP/5.2.10
Content-Type: text/html

Query 'title' retrieved 16 of 16 matches in 0.001 sec.
Query stats:

'Title' found 61 times in 16 documents ents

Matches:
1. doc_id = 44, Weight = 2, created = 07:33:27
2. doc_id = 1, Weight = 1, created = 07:33:28
3. doc_id = 4, Weight = 1, created = 07:33:28
4. doc_id = 5, Weight = 1, created = 07:33:28
5. doc_id = 10, Weight = 1, created = 07:33:28
6. doc_id = 11, Weight = 1, created = 07:33:28
7. doc_id = 20, Weight = 1, created = 07:33:28
8. doc_id = 21, Weight = 1, created = 07:33:28
9. doc_id = 24, Weight = 1, created = 07:33:28
10. doc_id = 25, Weight = 1, created = 07:33:28
11. doc_id = 26, Weight = 1, created = 07:33:28
12. doc_id = 27, Weight = 1, created = 07:33:28
13. doc_id = 28, Weight = 1, created = 07:33:28
14. doc_id = 30, Weight = 1, created = 07:33:28
15. doc_id = 38, Weight = 1, created = 07:33:28
16. doc_id = 45, Weight = 1, created = 07:33:27

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.