solr相关配置
来源:互联网 发布:php 高德地图api接口 编辑:程序博客网 时间:2024/06/06 13:24
1、下载solr4.10链接:http://yun.baidu.com/share/link?shareid=859433875&uk=2887486548
2、修改 “core”索引的目录中的D:\solr\home\collection1\conf\solrconfig.xml
将<dataDir>${solr.data.dir:}</dataDir>
修改为:
<dataDir>${solr.data.dir:D:/solr/home/collection1/data}</dataDir>
3、复制:solr-4.10.0\example\lib\ext 下的jar包到 apache-tomcat-8.0.12\lib中4、在 tomcat的solr的WEB-INF下创建文件 classes文件夹,
复制:solr-4.10.0\example\resources\log4j.properties 到:d:\solr\server\WEB-INF\classes文件夹中
5、关于schema.xml的配置说明
(1)如果需要添加mmseg4j对solr的中文分词支持,添加:
<!--配置mmsg4j-->
<fieldtype name="textComplex" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex" dicPath="dic"/>
</analyzer>
</fieldtype>
<fieldtype name="textMaxWord" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" />
</analyzer>
</fieldtype>
<fieldtype name="textSimple" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple" dicPath="n:/custom/path/to/my_dic" />
</analyzer>
</fieldtype>
(2)添加自己的查询字段:
<field name="my_title" type="string" indexed="true" stored="true"/>
<field name="my_content" type="string" indexed="true" stored="true"/>
其中,name:表示要添加的查询字段
type:字段的类型,以及在schema.xml中有定义
indexed:是否索引
stored:是否存储
(3)如果需要同时在title和content中进行查询,可以添加如下字段:
<field name="title_content" type="textComplex" indexed="true" stored="false" multiValued="true"/>
<copyField source="my_title" dest="title_content"/>
<copyField source="my_content" dest="title_content"/>
其中:title_content为新定义的查询字段,如果需要同时在title和content中进行查询,那么就使用这个查询字段。
solr 有一个字段复制机制,可以提交多个不同类型字段集中到一个字段。字段复制主要涉及两个概念,source和destination,一个是要复制的字段,另一个是要复制到哪个字段
(4)设置默认查询字段,这样的话就不需要在Query中进行查询时使用my_title:hello这样的格式
将solrconfig.xml中得 <str name="df">text</str>
修改为: <str name="df">title_content</str>
这样,如果需要查询内容在标题字段或内容字段出现的结果的时候,只需要在查询条件中填写hello就可以了
- solr相关配置
- solr相关配置翻译
- Linux下Solr相关配置
- centos搭建solr环境以及相关配置
- Solr相关
- solr相关
- solr-solr参数,配置
- Solr在tomcat和jetty中启动的相关配置
- solr的安装、配置、启动,及相关学习资料
- solr配置
- solr配置
- solr配置
- solr 配置
- Solr配置
- 配置solr
- solr配置
- solr配置
- solr配置
- LTE小区搜索
- LeetCode Largest Rectangle in Histogram&&Maximal Rectangle
- C#第一次作业
- 第2章 1
- ApiDemos 导入 intellij idea 中
- solr相关配置
- 算法竞赛入门经典 暴力求解法 简单枚举 7.1.4 双基回文数
- 清除UIWebView的缓存
- 商品条形码(JBarcode)Java版(二)
- const 与重载
- 为什么我们选择Unity3D 以及我们的策略
- 使用NSAnimationContext实现简单的NSView动画
- ISO8583开发注意事项和心得体会
- sass的安装和用法