1.拷贝jar包

  

2.复制IKanalyzer分析器配置

  

1.ext.dic

高富帅
黑马程序员
二维表

 

2.IKAnalyzer.cfg.xml

  

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">  
<properties>  
    <comment>IK Analyzer 扩展配置</comment>
    <!--用户可以在这里配置自己的扩展字典 -->
    <entry key="ext_dict">ext.dic;</entry> 
    
    <!--用户可以在这里配置自己的扩展停止词字典-->
    <entry key="ext_stopwords">stopword.dic;</entry> 
    
</properties>

 

3.stopword.dic

  

我
是
用
的
二
维
表
来
a
an
and
are
as
at
be
but
by
for
if
in
into
is
it
no
not
of
on
or
such
that
the
their
then
there
these
they
this
to
was
will
with

 

3.配置solr-home\collection1\conf\schema.xml

     <!-- IKAnalyzer -->
  <fieldType name="text_ik" class="solr.TextField">
      <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
    </fieldType>
  <field name="title_ik" type="text_ik" indexed="true" stored="true" required="true" multiValued="false" /> 
  <field name="content_ik" type="text_ik" indexed="true" stored="true" required="true" multiValued="false" /> 

 

 

4.测试:

 

【当你用心写完每一篇博客之后,你会发现它比你用代码实现功能更有成就感!】