search
HomeBackend DevelopmentPHP TutorialLearn sphinx sphinx Chinese django sphinx python sphinx usage

How to use sphinx technology in our PHP development?

Answer: Corresponding to the fields in the MySQL database, it means splitting the Chinese information in the fields into multiple words, and then indexing these words. When querying in the future, first query these index files, then return the primary key IDs of the records that meet the conditions, and then query the MySQL database based on the primary key IDs to return the records.

sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

What is sphinx? (Baidu Encyclopedia)

Note: For sphinx, if there are tens of millions of records in a single table, the response time is at the millisecond level.

sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

Note: By default sphinx only supports English and Russian

Official website:

http://sphinxsearch.com/

Since Sphinx only supports the above two languages, a third-party company has developed a middle segmentation package for sphinx called coreseek

Official website:

http://www.coreseek.cn/

sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

Customer case: http://www.coreseek.cn/products/ft_powered/

Note two points:

  1. sphinx is a full-text search engine that only supports Russian and English

  2. Due to the above reasons, a specialized company has developed a Chinese word segmentation package called coresesk.

  3. There is a company in China that does a better job (massive word segmentation)

    http://www.hylanda.com/

    Story: http://home.hylanda.com/show_5_19.html

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Practical operation

  4. Download

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    2. Build a big data table (lyrics table)

    mysql > source d:/songs.sql

    File Directory:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法Command:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    sphinx installation-use

    Installation

    Please note: sphinx configuration file must not be opened using Windows Notepad. (BOM header)

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    API interface file: You can use php to call this interface to operate the index file on the sphinx server side.

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  5. Modify configuration file

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Index file

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Memory settings:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    sphinxd configuration:

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  6. Indexing

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    The name after index in the configuration file

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Directory structure after indexing

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    3. Actual use

    a. Start the sphinx service and use the help information to see how to use it.

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Use:

  7. You can read the configuration file separately and run it

  8. can also be installed as a system service in Windows to run

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Start the sphinx service (read the configuration file for a single start)

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    is defined as after system service (installation)

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    Use

    1. Specific use (sphinx process can be seen in the picture below)

    sphinx flow chart:

    sphinx storage engine: Through the following steps, we found that when the PHP program performs a query, it must first return the primary key ID based on the sphinx server, then query the MySQL database based on the primary key ID, and finally return the database.

    At this time, you can think like this, use sphinx as a storage engine of MySQL. At this time, the php program can directly connect to the MySQL server, and the MySQL server obtains the word segmented data from its own sphinx storage engine. There is no need to connect to the sphinx server once. This storage engine is called sphinxSE.

    http://blog.csdn.net/uestc_huan/article/details/6395145

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  9. Easy to use

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

  10. use

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

    sphinx 文档,sphinx 安装,sphinx cat,sphinx doc,sphinx 中文,django sphinx,python sphinx用法

The above has introduced learning sphinx, including sphinx content. I hope it will be helpful to friends who are interested in PHP tutorials.

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
如何使用php扩展Sphinx进行全文搜索如何使用php扩展Sphinx进行全文搜索Jul 29, 2023 am 10:05 AM

如何使用PHP扩展Sphinx进行全文搜索全文搜索是现代Web应用程序中的常见需求之一。为了满足用户对数据的高效查询和检索,我们可以使用Sphinx这个功能强大的开源搜索引擎来实现全文搜索功能。Sphinx使用C++编写,提供了PHP的扩展,方便我们在PHP项目中使用。本文将介绍如何使用PHP扩展Sphinx进行全文搜索

Sphinx 实现全文搜索的 PHP 应用指南Sphinx 实现全文搜索的 PHP 应用指南Oct 03, 2023 am 08:37 AM

Sphinx实现全文搜索的PHP应用指南引言:在现代的Web应用中,全文搜索功能已经成为了一个必备的特性。因为用户常常会通过输入关键词来搜索和匹配他们所需要的内容。为了提供高效和准确的搜索结果,我们需要一个强大的搜索引擎。而Sphinx作为一个开源的全文搜索引擎,它为PHP提供了一个完美的搜索解决方案。本文将介绍如何使用Sphinx实现

Sphinx PHP 在自然语言处理中的应用技巧Sphinx PHP 在自然语言处理中的应用技巧Oct 03, 2023 am 09:53 AM

SphinxPHP在自然语言处理中的应用技巧,需要具体代码示例随着互联网的发展和人工智能技术的进步,自然语言处理(NaturalLanguageProcessing,NLP)成为了计算机科学中一个重要的研究方向。自然语言处理的目标是让计算机能够理解、解释和生成自然语言,使得人与机器之间的交流更加便捷和智能化。在自然语言处理中,文本检索是一个非常重要

Sphinx 实现 PHP 项目的实时搜索效果Sphinx 实现 PHP 项目的实时搜索效果Oct 03, 2023 am 09:16 AM

Sphinx是一个开源的全文搜索引擎,可以快速、高效地实现大规模数据的搜索和检索。在PHP项目中,使用Sphinx可以实现实时搜索效果,提升用户体验和搜索速度。本文将介绍如何在PHP项目中使用Sphinx,并提供具体的代码示例。一、安装Sphinx要在PHP项目中实现实时搜索效果,首先需要安装Sphinx。可以在Sphinx的官方

Sphinx 分布式搜索的 PHP 实现方法解析Sphinx 分布式搜索的 PHP 实现方法解析Oct 03, 2023 am 08:49 AM

Sphinx分布式搜索的PHP实现方法解析引言:在当今互联网时代,搜索引擎已经成为人们获取信息的主要方式之一。为了提供更高效、更准确的搜索结果,一些大规模的网站或应用程序通常会使用分布式搜索引擎来处理搜索请求。Sphinx是一种知名的分布式搜索引擎,具有良好的性能和扩展性。本文将介绍如何使用PHP实现Sphinx分布式搜索,并提供具体的代码示

Sphinx 实现 PHP 项目的快速搜索与缓存优化Sphinx 实现 PHP 项目的快速搜索与缓存优化Oct 03, 2023 am 09:01 AM

Sphinx是一款开源的全文搜索引擎,它能够快速地处理大量的数据并提供高效的搜索功能。在PHP项目中使用Sphinx,可以实现快速的搜索和缓存优化,提升项目的性能和用户体验。本文将介绍如何在PHP项目中集成Sphinx,并通过具体的代码示例来说明其使用方法和优势。一、Sphinx的安装与配置要使用Sphinx,首先需要在服务器上进行安装并进

Sphinx PHP 在电商网站中的商品搜索与排序优化Sphinx PHP 在电商网站中的商品搜索与排序优化Oct 03, 2023 am 10:53 AM

SphinxPHP在电商网站中的商品搜索与排序优化在电商网站中,商品的搜索与排序是用户体验和销售转化的重要因素之一。为了提高用户的搜索体验和呈现与用户需求最匹配的结果,SphinxPHP是一款非常强大且广泛应用的全文搜索引擎。本文将介绍如何利用SphinxPHP在电商网站中进行商品搜索与排序优化,并提供具体的代码示例。一、安装和配置Sphin

如何在ThinkPHP6中使用Sphinx进行全文搜索?如何在ThinkPHP6中使用Sphinx进行全文搜索?Jun 12, 2023 pm 12:40 PM

在现代的Web开发中,搜索引擎已经成为了一个不可或缺的部分。与其它搜索引擎相比,Sphinx是一种专门用来处理全文搜索的服务。在本文中,我们将详细介绍如何在ThinkPHP6中集成Sphinx进行全文搜索。安装Sphinx首先,我们需要在服务器上安装Sphinx。以下是在Ubuntu系统上安装Sphinx的示例命令:$sudoap

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools