1.1. Solr的环境

Solr是java开发。

需要安装jdk。

安装环境Linux。

需要安装Tomcat。

1.2. 搭建步骤

第一步:把solr 的压缩包上传到Linux系统

第二步:解压solr。

第三步:安装Tomcat,解压缩即可。

第四步:把solr部署到Tomcat下。

第五步:解压缩war包。启动Tomcat解压。

第六步:把/root/solr-4.10.3/example/lib/ext目录下的所有的jar包,添加到solr工程中。

[root@localhost ext]# pwd

/root/solr-4.10.3/example/lib/ext

[root@localhost ext]# cp * /usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/

第七步:创建一个solrhome。/example/solr目录就是一个solrhome。复制此目录到/usr/local/solr/solrhome

[root@localhost example]# pwd

/root/solr-4.10.3/example

[root@localhost example]# cp -r solr /usr/local/solr/solrhome

[root@localhost example]#

第八步:关联solr及solrhome。需要修改solr工程的web.xml文件。

第九步:启动Tomcat

http://192.168.25.154:8080/solr/

和windows下的配置完全一样。

1.3. 配置业务域

schema.xml中定义

1、商品Id

2、商品标题

3、商品卖点

4、商品价格

5、商品图片

6、分类名称

7、商品描述

创建对应的业务域。需要制定中文分析器。

创建步骤:

第一步:把中文分析器添加到工程中。

1、把IKAnalyzer2012FF_u1.jar添加到solr工程的lib目录下

2、把扩展词典、配置文件放到solr工程的WEB-INF/classes目录下。

第二步:配置一个FieldType,制定使用IKAnalyzer

修改schema.xml文件

修改Solr的schema.xml文件,添加FieldType:

<fieldType name="text_ik" class="solr.TextField">

<analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>

</fieldType>

第三步:配置业务域,type制定使用自定义的FieldType。

设置业务系统Field

<field name="item_title" type="text_ik" indexed="true" stored="true"/>

<field name="item_sell_point" type="text_ik" indexed="true" stored="true"/>

<field name="item_price"  type="long" indexed="true" stored="true"/>

<field name="item_image" type="string" indexed="false" stored="true" />

<field name="item_category_name" type="string" indexed="true" stored="true" />

<field name="item_desc" type="text_ik" indexed="true" stored="false" />

<field name="item_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/>

<copyField source="item_title" dest="item_keywords"/>

<copyField source="item_sell_point" dest="item_keywords"/>

<copyField source="item_category_name" dest="item_keywords"/>

<copyField source="item_desc" dest="item_keywords"/>

第四步:重启tomcat

最新文章

  1. 微信公众平台自动回复wechatlib.jar的生成及wechatlib解析
  2. 3种Java从文件路径中获取文件名的方法
  3. 使用Spring整合Hibernate,并实现对数据表的增、删、改、查的功能
  4. 有趣的linux命令
  5. iis 支持html执行php输出
  6. Maven多层嵌套
  7. 我的Android进阶之旅------&gt;Android拍照小例子
  8. 深入研究ES6 Generators
  9. Linux ipip隧道及实现
  10. 自主学习之RxSwift(二) -----flatMap
  11. mysql使用索引的注意事项
  12. php的接口,抽象类,trait(转载,合并)
  13. Celery - 一个懂得 异步任务 , 定时任务 , 周期任务 的芹菜
  14. LOJ #2026「JLOI / SHOI2016」成绩比较
  15. angularjs入门初体验
  16. MongoDB与关系型数据库 区别
  17. TOJ 3151: H1N1&#39;s Problem(欧拉降幂)
  18. pt-online-schema-change的实现原理
  19. Github常用命令【转】
  20. TCP/IP协议 socket

热门文章

  1. hashCode equals hashSet
  2. hdu 1277 全文检索 (字典树应用)
  3. Yota Phone宣告破产
  4. 51nod 1429:巧克力
  5. HDU 5280 BestCoder Round #47 1001:Senior&#39;s Array
  6. Jetson TX2 安装JetPack3.3教程
  7. 通过Request获取客户端的真实IP
  8. Python Learning Day7
  9. 体验京东云 Serverless+AI 人脸属性识别
  10. 寒假day21