============== 我的配置 ============
solrconfig.xml
- <searchComponent class="solr.SpellCheckComponent" name="suggest">
- <str name="queryAnalyzerFieldType">text_spell</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">suggestion</str>
- <!-- the indexed field to derive suggestions from -->
- <float name="threshold">0.0001</float>
- <str name="spellcheckIndexDir">spellchecker</str>
- <str name="comparatorClass">freq</str>
- <str name="buildOnOptimize">true</str>
- <!--<str name="buildOnCommit">true</str>-->
- </lst>
- </searchComponent>
- <requestHandler class="org.apache.solr.handler.component.SearchHandler"
- name="/suggest">
- <lst name="defaults">
- <str name="spellcheck">true</str>
- <str name="spellcheck.dictionary">suggest</str>
- <str name="spellcheck.onlyMorePopular">true</str>
- <str name="spellcheck.extendedResults">false</str>
- <str name="spellcheck.count">10</str>
- <str name="spellcheck.collate">true</str>
- </lst>
- <arr name="components">
- <str>suggest</str>
- </arr>
- </requestHandler>
- <queryConverter name="phraseQueryConverter" class="org.apache.solr.spelling.SpellingQueryConverter"/>
schema.xml
- <fieldType name="text_spell" class="solr.TextField">
- <analyzer type="index">
- <tokenizer class="solr.StandardTokenizerFactory"/>
- <filter class="solr.LowerCaseFilterFactory"/>
- </analyzer>
- <analyzer type="query">
- <tokenizer class="solr.StandardTokenizerFactory"/>
- <filter class="solr.LowerCaseFilterFactory"/>
- </analyzer>
- </fieldType>
- <field name="suggestion" type="text_spell" indexed="true" stored="true" termVectors="true" multiValued="true" />
- <copyField source="title" dest="suggestion" />
http://localhost:8080/solr/core/suggest?q=No&wt=json&indent=true&
spellcheck.build=true