為Xunsearch添加索引以及導入mysql文件記錄


之前我們已經成功安裝完成xunsearch以及啟動相關進程:那么今天咱們來看下如何和你的mysql進行交互

建立索引  先創建要索引的數據庫表:

創建庫:CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
創建表:……
先在/usr/local/xunsearch/sdk/php/app配置ini文件:
project.name = source
project.default_charset = utf-8
server.index = 23.27.127.32:8383
server.search = 23.27.127.32:8384
[id]
type = id
[product_name]
type = title
[product_model]
index = self
以上配置可以使用官網的ini配置生成器生成好代碼在寫入到相關文件夾下
http://www.xunsearch.com/tools/iniconfig 導入mysql數據到xunsearch里面:
/usr/local/xunsearch/sdk/php/util/Indexer.php --rebuild --source=mysql://yourdbuser:yourdbpass@localhost/yourdbname --sql="select id,product_name,product_model from products" --project=source
util/Indexer.php --rebuild --source=mysql://你的數據庫用戶名:你的數據庫密碼@你的數據庫IP/你的數據庫名 --sql="你要執行的SQL語句" --filter=debug --project=你的項目名

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM