solr suggest 配置

 

  1. add into solrconfig.xml

  

<searchComponent name="suggest" class="solr.SpellCheckComponent">
	<str name="queryAnalyzerFieldType">text_ik</str>
	<lst name="spellchecker">  
		<str name="name">suggest</str>  
		<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>  
		<str name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>  
		<str name="field">suggest_title</str>
		<float name="threshold">0.0001</float>
		<!--<str name="sourceLocation">suggest_dict.txt</str>-->
		<!--<str name="spellcheckIndexDir">spellchecker</str>-->
        <str name="comparatorClass">freq</str>
        <str name="buildOnOptimize">true</str>
		<str name="buildOnCommit">true</str>     
	</lst>  
  </searchComponent>    
 
  <requestHandler name="/suggest" class="org.apache.solr.handler.component.SearchHandler">  
	<lst name="defaults">  
		<str name="spellcheck">true</str>  
		<str name="spellcheck.dictionary">suggest</str>  
		<str name="spellcheck.count">8</str>  
		<str name="spellcheck.onlyMorePopular">true</str>
		<str name="spellcheck.extendedResults">false</str>		
		<str name="spellcheck.collate">true</str>
		<!--<str name="spellcheck.build">true</str>	-->	
	</lst>  
	<arr name="components">  
		<str>suggest</str>  
	</arr>  
  </requestHandler>

 

 

   2.add into schma.xml

   

<field name="suggest_title" type="text_auto" indexed="true" stored="true" multiValued="false" />

    

<copyField source="faqTitle" dest="suggest_title"/>

    

<fieldType name="text_auto" class="solr.TextField">  
   <analyzer>  
	<tokenizer class="solr.KeywordTokenizerFactory"/>  
	<filter class="solr.LowerCaseFilterFactory"/>  
   </analyzer>
</fieldType>

 

 

  

你可能感兴趣的:(suggest)