How do we use Sphinx technology in our PHP development?
A: The fields in the MySQL database are split into multiple words in a field, and the words are indexed. In the future, query these index files, then return the primary key IDs of the records that meet the criteria, then query the MySQL database based on the primary key ID and return the records.
What is Sphinx? (Baidu Encyclopedia)
Note: For Sphinx, single-table thousands records, the response time is the millisecond level.
Note: The default Sphinx only supports English and Russian
Website:
http://sphinxsearch.com/
Because Sphinx only support the above two languages, so there are third-party companies for the Sphinx development of the sub-word packet, called Coreseek
Website:
http://www.coreseek.cn/
Customer Case: http://www.coreseek.cn/products/ft_powered/
Note two points:
Sphinx is a full-text search engine that supports only Russian and English
Because of the above reasons, there are specialized companies for its development of Chinese word breaker, called Coresesk.
China has a better company to do (massive participle)
http://www.hylanda.com/
Story: http://home.hylanda.com/show_5_19.html
Real Exercise
Download
2. Build a table of Big data (lyrics table)
MySQL > Source d:/songs.sql
File directory:
Command:
Sphinx Installation-Use
Installation
Note: Sphinx configuration files must not be opened using Windows Notepad. (BOM header)
API interface File: You can use PHP to invoke the interface to operate the Sphinx Server-side index file.
Modifying a configuration file
Index file
Memory settings:
SPHINXD configuration:
Build an index
Name after index in the configuration file
The directory structure after the index is built
3. Actual use
A. Turn on Sphinx Services and use the Help information to see how to use
Use:
You can run a separate read configuration file
can also be installed as a Windows system service to run
Start the Sphinx service (read profile one-time boot)
After defined as system service (install)
Use
1. Specific use (Sphinx process can be seen)
Sphinx Flowchart:
Sphinx Storage Engine: Through the following steps found that the PHP program in the query, you must first return the primary key ID according to the Sphinx server, and then according to the primary key ID to query the MySQL database, and finally return to the database.
This time, you can think of this, sphinx as a storage engine for MySQL, this time the PHP program can directly connect to the MySQL server, the MySQL server to its own Sphinx storage engine to obtain the data after the word. There is no need to connect the Sphinx server once. This storage engine is called Sphinxse.
http://blog.csdn.net/uestc_huan/article/details/6395145
Simple to use
Use
The above describes the learning Sphinx, including the content of the Sphinx, I hope that the PHP tutorial interested in a friend helpful.