howto:solr全文检索配置

配置文件中已配置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中
  howto:solr全文检索配置
  howto:solr全文检索配置
 
注意 localhost:8983/solr/browser 搜索不出东西,服务器段有进一步加工,
用localhost:8983/solr/admin 直接搜索 “能够”,返回正确结果。
还要解决问题:
 
示例在嵌入的jetty中运行,配置直接google solr安装配置
真正环境配置中tomcat要处理中文乱码
更改server.xml 将get编码改成utf-8.
howto:solr全文检索配置
 





附件列表

 

你可能感兴趣的:(Solr)