测试ubuntu安装sphinx及配置集成到magento产品搜索
2014-03-18 16:52
381 查看
本机的测试环境为ubuntu版本为13.10, 目的是为magento产品搜索集成sphinx
直接
sudo apt-get install sphinxsearch
就安装成功了, 哈,简单吧...
装是装了, 怎么用呢?
whereis sphinxsearch
找到sphinx的路径,默认在 /etc/sphinxsearch
cd /etc/sphinxsearch
sphinx.conf.sample 有详细说明配置文件的各参数作用
sphinx-min.conf.dist是一个测试的模板文件了,
cp sphinx-min.conf.dist sphinx.conf
我的sphinx.conf配置如下 ,注意修改 sql连接的相关信息, 那段sql_query是怎么来的? 你就在magento搜索的collection打印一下它的sql,把它COPY过来,再select 你要的字段.
写完配置文件,要生成索引
sudo indexer --config /etc/sphinxsearch/sphinx.conf --all
注意config,all前是两个横
indexer,search,searchd是sphinxsearch安装后就有的了,如果你是源码安装,会在对应目录的bin下
最后你要测试一下,
sudo search --config /etc/sphinxsearch/sphinx.conf "你要找的产品关键字"
如果你没有注释了sql_query_info = SELECT * FROM documents WHERE id=$id
是会报错的, 因为你的数据库中没有这个documents表, 可以看一下/etc/sphinxsearch/example.sql 有一个建这个表的sql ,
启用服务
sudo searchd --config /etc/sphinxsearch/sphinx.conf
好了,这样就可以了, 至于magento如何集成sphinx, 就去找一个插件罗,如果你是极客,喜欢自己写, 主要是重写CatalogSearch_Block_Result
加油!
直接
sudo apt-get install sphinxsearch
就安装成功了, 哈,简单吧...
装是装了, 怎么用呢?
whereis sphinxsearch
找到sphinx的路径,默认在 /etc/sphinxsearch
cd /etc/sphinxsearch
sphinx.conf.sample 有详细说明配置文件的各参数作用
sphinx-min.conf.dist是一个测试的模板文件了,
cp sphinx-min.conf.dist sphinx.conf
我的sphinx.conf配置如下 ,注意修改 sql连接的相关信息, 那段sql_query是怎么来的? 你就在magento搜索的collection打印一下它的sql,把它COPY过来,再select 你要的字段.
# # Minimal Sphinx configuration sample (clean, simple, functional) # source src1 { type = mysql sql_host = localhost sql_user = root sql_pass = 123456 sql_db = magentodb sql_port = 3306 # optional, default is 3306 sql_query =SELECT `e`.`entity_id`,`e`.`sku`, `_table_short_descrip_default`.value AS `short_description`,`_table_titile`.value AS `title`,`_table_descrip_default`.value AS `description` FROM `catalog_product_entity` AS `e` LEFT JOIN `catalog_product_entity_text` AS `_table_short_descrip_default` ON (_table_short_descrip_default.entity_id = e.entity_id) AND (_table_short_descrip_default.attribute_id = (select attribute_id from eav_attribute where attribute_code='short_description' and entity_type_id=(select entity_type_id from eav_entity_type where entity_model='catalog/product'))) LEFT JOIN `catalog_product_entity_varchar` AS `_table_titile` ON (_table_titile.entity_id = e.entity_id) AND (_table_titile.attribute_id = (select attribute_id from eav_attribute where attribute_code='name' and entity_type_id=(select entity_type_id from eav_entity_type where entity_model='catalog/product'))) LEFT JOIN `catalog_product_entity_text` AS `_table_descrip_default` ON (_table_descrip_default.entity_id = e.entity_id) AND (_table_descrip_default.attribute_id=(select attribute_id from eav_attribute where attribute_code='description' and entity_type_id=(select entity_type_id from eav_entity_type where entity_model='catalog/product')))LEFT JOIN `catalog_product_entity_int` AS `_table_status_default` ON (_table_status_default.entity_id = e.entity_id) AND (_table_status_default.attribute_id=(select attribute_id from eav_attribute where attribute_code='status' and entity_type_id=(select entity_type_id from eav_entity_type where entity_model='catalog/product'))) where `_table_status_default`.value=1 sql_attr_uint = group_id sql_attr_timestamp = date_added # sql_query_info = SELECT * FROM documents WHERE id=$id } index test_magento { source = src1 path = /var/lib/sphinxsearch/data/test_magento docinfo = extern charset_type = utf-8 } indexer { mem_limit = 256M } searchd { listen = 9312 listen = 9306:mysql41 log = /var/log/sphinxsearch/searchd.log query_log = /var/log/sphinxsearch/query.log read_timeout = 5 max_children = 30 pid_file = /var/run/sphinxsearch/searchd.pid max_matches = 1000 seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work binlog_path = /var/lib/sphinxsearch/data }
写完配置文件,要生成索引
sudo indexer --config /etc/sphinxsearch/sphinx.conf --all
注意config,all前是两个横
indexer,search,searchd是sphinxsearch安装后就有的了,如果你是源码安装,会在对应目录的bin下
最后你要测试一下,
sudo search --config /etc/sphinxsearch/sphinx.conf "你要找的产品关键字"
如果你没有注释了sql_query_info = SELECT * FROM documents WHERE id=$id
是会报错的, 因为你的数据库中没有这个documents表, 可以看一下/etc/sphinxsearch/example.sql 有一个建这个表的sql ,
启用服务
sudo searchd --config /etc/sphinxsearch/sphinx.conf
好了,这样就可以了, 至于magento如何集成sphinx, 就去找一个插件罗,如果你是极客,喜欢自己写, 主要是重写CatalogSearch_Block_Result
加油!
相关文章推荐
- 测试ubuntu安装sphinx及配置集成到magento产品搜索
- ubuntu下的中文搜索sphinx实时索引的安装配置
- 在ubuntu上安装全文搜索中文分词Coreseek/sphinx及和Rails集成
- 在ubuntu上安装全文搜索中文分词Coreseek/sphinx及和Rails集成 转载
- ubuntu下的中文搜索sphinx的安装配置
- ubuntu下的中文搜索sphinx实时索引的安装配置
- ubuntu下的中文搜索sphinx的安装配置
- Oracle10gR2在Ubuntu10.10下的安装配置及链接测试
- Coreseek/Sphinx安装测试配置指南
- 在windows下Sphinx\Coreseek的配置安装与测试
- Ubuntu上snmp安装、配置、启动及远程测试完整过程 推荐
- sphinx 与搜索的安装配置过程
- ubuntu16.04安装CPU版SSD及caffe配置,训练及测试过程
- ubuntu java javac 安装和环境变量配置和测试
- 在Ubuntu下安装、配置和测试cuda
- 【中文分词-全文搜索】Ubuntu 16.04 Mysql和PHP 配置 Sphinx-for-chinese 及Sphinx的排序筛选分页基本操作
- ubuntu上 安装 基于sphinx 的 coreseek 全文搜索
- Discuz! X2 sphinx全文搜索安装配置实战
- ubuntu10.10 tftp安装,配置,测试
- ubuntu安装集成lamp环境后如何配置多站点