YII2 Integrated fast Search to achieve efficient Chinese word search. This paper mainly introduces the method of integrating Xunsearch search engine in YII2 framework, and analyzes the concrete steps and related precautions of YII2 framework integration Xunsearch with the example form, and the friends can refer to them. We hope to help you.
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 quick-Build Full-text search function under InnoDB engine")
Xunsearch temporarily only Liunx server and PHP-SDK. But the author does provide a YII2 extension. Suddenly feel good happy to say.
It would have been easier to write a simple add index and update index by using PHP-SDK, but also to have the ability to delete an index, but with a multi-item scenario in mind. is a xunsearch can be common to multiple projects, all configuration files are placed in each project's configuration file, according to the project's configuration file to distinguish each search database. This is my first thought, but the point is not how to think, but how to do it. Practice is the hard truth, and then you encounter the following problems.
See the official http://www.yiiframework.com/extension/yii-xunsearch/#hh4 here the target link, I will next say installation experience
Application Components ' components ' [ /... ] Xunsearch ' = = [ ' class ' = ' hightman\xunsearch\connection ',//This line must be, this is not necessarily the case, May be hightman.xunsearch.Connection based on actual project ' inidirectory ' = ' @app/config ', //Search INI file directory, default: @vendor/ Hightman/xunsearch/app ' charset ' = ' utf-8 ', //Specify the default encoding used by the project, 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
Online Some people say is php.ini inside the configuration problem, said put, short_open_tag change into on, I first see feel very reasonable, and then find found, originally is on.
Because that YII2 extension uses the namespace effects of PHP5.3. And my local PHP version is 5.2.6. I said I couldn't be calm. The thing that tortured the day, incredibly because the PHP version is too low ...
To summarize here.
Related recommendations:
Yii2 modal the activeform of pop-up window to implement AJAX form asynchronous validation
YII2 realization of RBAC permission control
How to register and create a component in Yii2