Home Backend Development PHP Tutorial How Yii2 framework integrates Xunsearch search engine

How Yii2 framework integrates Xunsearch search engine

Feb 11, 2018 pm 05:03 PM
xunsearch yii2 search engine

This article mainly introduces the method of Yii2 framework integrating Xunsearch search engine, and analyzes the specific steps and related steps of Yii2 framework integrating Xunsearch in the form of examples. Notes, friends who are accustomed to using Yii2 framework should be careful Don’t miss this article! !

The example in this article describes how the Yii2 framework integrates the Xunsearch search engine. I would like to share it with you for your reference. The details are as follows:

The company has been using the YII2 framework, and then wants to build a Chinese search engine. The Xunsearch project that everyone is thinking of has been mentioned in a previous article, how to install the Xunsearch server.

xunsearch currently only has the Liunx server and PHP-SDK. But the author does provide an extension for YII2. I suddenly felt so happy.

Originally I was writing a simple function of adding index, updating index and deleting index by using PHP-SDK, but I took into account the situation of multiple projects. That is, one Xunsearch can be shared by multiple projects. All configuration files are placed in the configuration file of each project, and each search database is distinguished according to the configuration file of this project. This was my initial thought, but the point is not what I think, but how I do it. Practice is the last word, and then you encounter the following problems.

http://www.yiiframework.com/extension/yii-xunsearch/#hh4 Here is the target link. I will talk about the installation experience next.

// application components
  'components => [
    // ... other components ...
    'xunsearch' => [
      'class' => 'hightman\xunsearch\Connection', // 此行必须,这里不一定是这写的,可能是hightman.xunsearch.Connection 根据实际项目出发
      'iniDirectory' => '@app/config',  // 搜索 ini 文件目录,默认:@vendor/hightman/xunsearch/app
      'charset' => 'utf-8',  // 指定项目使用的默认编码,默认即时 utf-8,可不指定
    ],
  ],
Copy after login

Then , if your PHP environment is an integrated installation package, you may encounter such a problem

Unexpected character in input: '\' (ASCII=92) state=1

Some people on the Internet said that it was a configuration problem in php.ini. They said that short_open_tag should be changed to On. I thought it made sense at first glance, and then I found out that it was originally On.

Then I went to http://stackoverflow.com (a technical forum used by technologies all over the world, the official language is English), and I found it. Knowing the truth, I really don’t want to think too much.

Because the YII2 extension uses the namespace special effects that are only available in PHP5.3. And my local PHP version is 5.2.6. I said I couldn't calm down. What tortured me all day was actually because the PHP version was too low. . .

That’s all.

Similar articles:

What should I do if the YII2 automatic login cookie always fails?

Recently done Yii2 automatic login function, found that even if the automatic login configuration function of Yii2 is turned on, after the browser is closed, again...

How to export Excel files from PHPExcel in the Yii2 framework

This article mainly introduces the relevant information about using PHPExcel to export Excel files in the Yii2 framework. It has certain reference value and feels...

Simple analysis of Yii2 using cache

A cached framework can be said to be a good framework. The editor below will introduce to you how to use yii2 through this article...

The above is the detailed content of How Yii2 framework integrates Xunsearch search engine. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Baidu cloud disk search engine entrance Baidu cloud disk search engine entrance Feb 27, 2024 pm 01:00 PM

Baidu Cloud is a software that allows users to store many files. So what is the entrance to Baidu Cloud Disk search engine? Users can enter the URL https://pan.baidu.com to enter Baidu Cloud Disk. This sharing of the latest entrance to Baidu Cloud Disk search engine will give you a detailed introduction. The following is a detailed introduction. Take a look. . Baidu cloud disk search engine entrance 1. Qianfan search website: https://pan.qianfan.app Supports network disk: aggregate search, Alibaba, Baidu, Quark, Lanzuo, Tianyi, Xunlei network disk viewing method: login required, follow the company Advantages of obtaining the activation code: The network disk is comprehensive, there are many resources, and the interface is simple. 2. Maolipansou website: alipansou.c

Java development: How to implement search engine and full-text retrieval functions Java development: How to implement search engine and full-text retrieval functions Sep 21, 2023 pm 01:10 PM

Java development: How to implement search engine and full-text retrieval functions, specific code examples are required Search engines and full-text retrieval are important functions in the modern Internet era. Not only do they help users find what they want quickly, they also provide a better user experience for websites and apps. This article will introduce how to use Java to develop search engines and full-text retrieval functions, and provide some specific code examples. Full-text search using Lucene library Lucene is an open source full-text search engine library, developed by ApacheSo

PHP search engine performance optimization: Algolia's magic trick PHP search engine performance optimization: Algolia's magic trick Jul 23, 2023 pm 04:21 PM

PHP Search Engine Performance Optimization: Algolia’s Magical Way With the development of the Internet and the increasing user requirements for search experience, search engine performance optimization has become crucial. In the world of PHP development, Algolia is a powerful and easy-to-integrate search engine service. This article will introduce the magical uses of Algolia and how to optimize the performance of PHP search engines through Algolia. Algolia introduction Algolia is a search engine service provider based on SaaS model.

How to set up Google Chrome to change the search engine? How to change the search engine in the browser How to set up Google Chrome to change the search engine? How to change the search engine in the browser Mar 15, 2024 pm 12:49 PM

How to change the search engine in Google Chrome? Google Chrome is a very popular browser among users. It not only has simple and easy-to-use services, practical tools and other auxiliary functions, but also can meet the different needs of different users. Search engines generally default to Google. If we want to How should I set it up to replace it? Let me share the method below. Replacement method 1. Click to open Google Chrome. 2. Click the three-dot icon to open the menu interface. 3. Click the Settings option to enter the browser’s settings interface. 4. Find the search engine module in the settings interface. 5. Click the Manage Search Engine button. 6. You can see an add button. Click this add button to add a search engine.​

PHP and Manticore Search Development: Building an Efficient Search Engine PHP and Manticore Search Development: Building an Efficient Search Engine Aug 07, 2023 am 09:45 AM

PHP and ManticoreSearch development: Building an efficient search engine Search engines play a very important role in modern Internet applications. In order to achieve efficient and accurate search functions, we need to choose a suitable search engine and use appropriate development tools for development. This article will introduce how to use PHP and ManticoreSearch to develop an efficient search engine. ManticoreSearch is a powerful open source search engine based on SphinxS

How to use Google Chrome search engine How to use Google Chrome search engine Jan 04, 2024 am 11:15 AM

Google Chrome is very good. There are many friends who use it. Many friends want to use Google’s own search engine, but don’t know how to use it. Here is a quick look at how to use Google Chrome’s Google search engine. Bar. How to use the Google search engine in Google Chrome: 1. Open Google Chrome and click More in the upper right corner to open settings. 2. After entering settings, click "Search Engine" on the left. 3. Check whether your search engine is "Google". 4. If not, you can click the drop-down button and change it to "Google".

Google search redesign: cancel continuous scrolling and return to paginated display Google search redesign: cancel continuous scrolling and return to paginated display Jun 27, 2024 am 09:47 AM

According to news from this site on June 26, according to SearchEngineLand, Google has now canceled the "continuous scrolling" display of the search results interface and switched to the "paging" mode that it has been using before. This site’s inquiry found that Google initially introduced “continuous scrolling” for mobile phones in October 2021, and then brought it to the desktop at the end of 2022. That said, "continuous scrolling" only lasted about a year and a half on desktop. A Google spokesperson told SearchEngineLand that the continuous scrolling feature will be removed from desktop search results today, and that the feature will be removed from mobile phones "in the coming months." As shown in the picture, Google has brought back the classic paging bar, allowing users to click on the number to jump to a specific page, or simply click "

Build an efficient search engine using PHP and Elasticsearch Build an efficient search engine using PHP and Elasticsearch Jul 09, 2023 pm 04:57 PM

Use PHP and Elasticsearch to build an efficient search engine Introduction: In today's Internet era, search engines are people's first choice for obtaining information. In order to provide fast and accurate search results, developers need to build efficient search engines. This article will introduce how to use PHP and Elasticsearch to build an efficient search engine, and give corresponding code examples. 1. What is Elasticsearch? Elasticsearch is a distributed open source search and analytics

See all articles