Use Alibaba Cloud to build an on-site search engine at low cost. I have posted one before, but it is incomplete. You have been waiting for a long time. Here is a screenshot. An online demonstration http://www.27tree.com/search/?q=html This is the real tutorial, just written, welcome to complain http://www.27tree.com/blog/2013-05- 07/content_397.html
- ///API access entrance
- define('APIROOT', 'http://css.aliyun.com');
- /// Please replace it with your user code
- define('CLIENT_ID', 6100098522958080) ;
- /// Please replace it with your key
- define('CLIENT_SECRET', '2e58ba4e81e092e616a73fb63845c043');
-
- $api = new CloudSearchApi(APIROOT, CLIENT_ID, CLIENT_SECRET);
-
- ///Get CloudSe arch object, assuming index The document has been created and uploaded.
- $indexName = 'test_index_1';
- $index = $api->getIndex($indexName);
- try {
- $result = $index->search('q=Cloud Search');
- } catch (Exception $e) {
- exit($e->getMessage());
- }
Copy code
|