YII2 Framework Integrated Xunsearch search engine methods _php skills

Source: Internet
Author: User
Tags php programming php regular expression

This article illustrates the method of YII2 framework integrating Xunsearch search engine. Share to everyone for your reference, specific as follows:

The company has been using the YII2 framework, and then to do a Chinese search engine, all want to xunsearch this project, before an article mentioned, how to install Xunsearch server. (Refer to PHP's concise tutorial on fast generation of Full-text search function under InnoDB engine)

Xunsearch temporarily only Liunx service and PHP-SDK. But the author does provide a YII2 extension. Suddenly feel good happy to say.

It was originally written using PHP-SDK to write a simple index and update index, as well as the ability to delete indexes, but with multiple projects in mind. is a xunsearch can be common to multiple projects, all profiles are placed in each project's configuration file, according to the project's configuration file to differentiate each search database. This is my first thought, but the point is not how to think, but how to do it. Practice is the absolute truth, and then you will encounter these problems below.

http://www.yiiframework.com/extension/yii-xunsearch/here the target link, I next to say installation experience

Application Components
  ' components => [
    //... other components ...
    ' Xunsearch ' => [
      ' class ' => ' hightman\xunsearch\connection ',//This must be, this is not necessarily the case here, May be hightman.xunsearch.Connection based on the actual project
      ' inidirectory ' => ' @app/config ',  //Search INI file directory, default: @vendor/ Hightman/xunsearch/app
      ' charset ' => ' utf-8 ',  //Specify default encoding for project use, default instant Utf-8, unspecified
    ],
  

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 it is php.ini inside the configuration problem, said put, Short_open_tag changed to ON, I first look feel very reasonable, and then find found, is on.

Then to Http://stackoverflow.com (the world's technology is used in a technical forum, the official language is English) above to look for, sure enough to find. Know the truth of me, really do not want more.

Because the extension of that YII2 uses the namespace effects that PHP5.3 have. And my local PHP version is 5.2.6. I don't mean to be calm. Torture a day of things, incredibly because the PHP version is too low ...

To sum it up here.

More about PHP Interested readers can view the site topics: "PHP Regular Expression Usage summary", "Php Curl Usage Summary", "PHP Array" operation Skills Encyclopedia, "PHP Sorting algorithm Summary", "PHP common traversal algorithm and skills summary", " PHP Data structure and algorithm tutorial, "PHP Programming Algorithm Summary", "PHP Mathematical Calculation Skills Summary", "PHP operation and operator Usage Summary", "PHP string (String) Usage summary" and "PHP common database Operation Skills Summary"

I hope this article will help you with the PHP program design.

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.