Home  >  Article  >  Backend Development  >  A brief tutorial on how to quickly build a full-text search function using PHP under the innodb engine

A brief tutorial on how to quickly build a full-text search function using PHP under the innodb engine

韦小宝
韦小宝Original
2018-02-11 17:04:101916browse

This article mainly introduces the method of PHP to quickly build the full-text search function under the innodb engine. It can be implemented based on the open source search indexxunsearch engine. It briefly describes the installation and use steps and related Operation skills, friends who operate search engines with PHP can refer to the following

Equipment that needs to be prepared: Liunx (Centos) operating system (only supports Linux), PHP environment.

Here is an introduction to a search engine open source project developed by Chinese people - xunsearch. It is divided into: index server and search server.

Happy server creation under CentOS

wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2
tar -xjf xunsearch-full-latest.tar.bz2

Ready to install

cd xunsearch-full-1.3.0/ sh setup.sh //You may encounter it here The problem of installation failure is because extensions such as gcc gcc-c++ are not installed. Installation with yum is very simple

When installing, you are required to enter the installation directory, usually /usr/local/xunsearch and press Enter and then enter Y and press Enter. The installation is a bit long. .

Wait for the installation to complete.

After the installation is completed, how to access across servers:

Installation directory (/usr/local/xunsearch/)+bin/xs-ctl.sh -b a.b.c.d start // Monitor at the specified Use this on IP to bind the monitor to the specified IP that can be accessed from the external network. Mine is 192.168.1163.130
You also need to use iptables to open ports 8383 and 8384. The simplest is to turn off iptables.

PHP-SDK Configuration fileModify as follows

[配置文件]
project.name = demo
project.default_charset = utf-8
server.index = 192.168.116.130:8383 //索引服务器的地址,默认是8383
server.search = 192.168.116.130:8384 //搜索服务器的地址,默认是8384
[pid]
type = id
[subject]
type = title //设置被索引字段
[message]
type = body  //设置被索引字段
[chrono]
type = numeric
[配置文件]

Please check the user manual for specific usage details:http:/ /www.xunsearch.com/doc/php/guide/index.overview

Performance test:

The above is all of this article The content is complete. If you are interested in PHP search engine development or the innodb engine, please read it in detail. If we encounter problems during development, you can also read the content mentioned in the article!

Get to know the article:

Comparison between MySQL storage engines MyISAM and InnoDB

Data in MySQL Stored in files (or memory) using various techniques. Each of these technologies uses different storage mechanisms, indexing techniques, locking...

Introduction to innoDB locks in mysql

This article mainly It introduces the innoDB lock in mysql. It is very good and has reference value. Friends who need it can refer to it...

Detailed explanation of the storage engine InnoDB and MyISAM in MySQL

MySQL5 InnoDB becomes the default storage engine in .5. InnoDB is a transactional storage engine designed to handle...

The above is the detailed content of A brief tutorial on how to quickly build a full-text search function using PHP under the innodb engine. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn