howto:solr全文检索配置
2012-01-19 16:43
344 查看
配置文件中已配置IK分词器,
与分词器关联类型为text
除将subject配置为 <uniqueKey>subject</uniqueKey> (必须为solr.StrField类型,所以配置为string)
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
配置详情:
<fieldType name="text" class="solr.TextField">
<analyzer type="index">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<field name="subject" type="string" indexed="true" stored="true"/>
<field name="content" type="text" indexed="true" stored="true"/>
<field name="searchable" type="text" indexed="true" stored="true"/>
<field name="type" type="text" indexed="true" stored="true"/>
<field name="audio" type="text" indexed="true" stored="true" multiValued="true"/>
<field name="video" type="text" indexed="true" stored="true" multiValued="true"/>
<uniqueKey>subject</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>searchable</defaultSearchField>
IK分词器下载地址:http://code.google.com/p/ik-analyzer/
用解压缩软件将IK分词器jar包,添加到solr.war中
![](http://images.cnblogs.com/cnblogs_com/HelloCoding/201201/201201191642297360.jpg)
![](http://images.cnblogs.com/cnblogs_com/HelloCoding/201201/201201191642311622.jpg)
注意 localhost:8983/solr/browser 搜索不出东西,服务器段有进一步加工,
用localhost:8983/solr/admin 直接搜索 “能够”,返回正确结果。
还要解决问题:
示例在嵌入的jetty中运行,配置直接google solr安装配置
真正环境配置中tomcat要处理中文乱码
更改server.xml 将get编码改成utf-8.
![](http://images.cnblogs.com/cnblogs_com/HelloCoding/201201/201201191642318208.png)
通过 ODC 发布
与分词器关联类型为text
除将subject配置为 <uniqueKey>subject</uniqueKey> (必须为solr.StrField类型,所以配置为string)
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
配置详情:
<fieldType name="text" class="solr.TextField">
<analyzer type="index">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="false"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="org.wltea.analyzer.solr.IKTokenizerFactory" isMaxWordLength="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<field name="subject" type="string" indexed="true" stored="true"/>
<field name="content" type="text" indexed="true" stored="true"/>
<field name="searchable" type="text" indexed="true" stored="true"/>
<field name="type" type="text" indexed="true" stored="true"/>
<field name="audio" type="text" indexed="true" stored="true" multiValued="true"/>
<field name="video" type="text" indexed="true" stored="true" multiValued="true"/>
<uniqueKey>subject</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>searchable</defaultSearchField>
IK分词器下载地址:http://code.google.com/p/ik-analyzer/
用解压缩软件将IK分词器jar包,添加到solr.war中
![](http://images.cnblogs.com/cnblogs_com/HelloCoding/201201/201201191642297360.jpg)
![](http://images.cnblogs.com/cnblogs_com/HelloCoding/201201/201201191642311622.jpg)
注意 localhost:8983/solr/browser 搜索不出东西,服务器段有进一步加工,
用localhost:8983/solr/admin 直接搜索 “能够”,返回正确结果。
还要解决问题:
示例在嵌入的jetty中运行,配置直接google solr安装配置
真正环境配置中tomcat要处理中文乱码
更改server.xml 将get编码改成utf-8.
![](http://images.cnblogs.com/cnblogs_com/HelloCoding/201201/201201191642318208.png)
通过 ODC 发布
附件列表
相关文章推荐
- 全文检索引擎Solr的配置
- solr全文检索服务器与tomact整合 IK Analyzer 2012FF_hf1 中文分词器的配置
- 你不知道的全文检索---solr安装中文分词器及配置业务字段
- 全文检索引擎Solr系列——Solr核心概念、配置文件
- 全文检索引擎Solr系列——Solr核心概念、配置文件
- 10006---全文检索引擎Solr系列——Solr核心概念、配置文件
- solr全文检索技术学习(一)-核心配置文件solrconfig.xml
- solr6.1-----相关配置-详细介绍-启动-全文检索
- 全文检索引擎Solr系列——Solr核心概念、配置文件
- 全文检索引擎Solr系列——Solr核心概念、配置文件
- solr全文检索技术学习(二)-schema.xml配置解析
- solr学习(1.3)-solr全文检索实现原理
- 全文检索引擎Solr系列—–全文检索基本原理
- 全文检索管理配置、使用手册
- Solr全文检索服务器搭建与基本使用介绍
- sphinx+scws 全文检索使用之 安装配置篇
- 全文检索之Lucene和Solr
- sphinx+scws 全文检索使用之 sphinx配置增量索引及sphinx管理命令
- 全文检索引擎Solr系列——整合中文分词组件mmseg4j
- solr-用mmseg4j配置同义词索引和检索(IKanlyzer需要修改源码适应solr接口才能使用同义词功能)