814247614 发表于 2017-12-19 14:39:14

Solr 6.7学习笔记(06)

<searchComponent name="spellcheck">  

  <str name="queryAnalyzerFieldType">text_general</str>
  <lst name="spellchecker">
  <str name="name">default</str>
  <str name="field">text</str>
  <str name="classname">solr.DirectSolrSpellChecker</str>
  <!-- the spellcheck distance measure used, the default is the internal levenshtein -->
  <str name="distanceMeasure">internal</str>
  <!-- minimum accuracy needed to be considered a valid spellcheck suggestion -->
  <float name="accuracy">0.5</float>
  <!-- the maximum #edits we consider when enumerating terms: can be 1 or 2 -->
  <int name="maxEdits">2</int>
  <!-- the minimum shared prefix when enumerating terms -->
  <int name="minPrefix">1</int>
  <!-- maximum number of inspections per result. -->
  <int name="maxInspections">5</int>
  <!-- minimum length of a query term to be considered for correction -->
  <int name="minQueryLength">4</int>
  <!-- maximum threshold of documents a query term can appear to be considered for correction -->
  <float name="maxQueryFrequency">0.01</float>
  <!-- uncomment this to require suggestions to occur in 1% of the documents
  <float name="thresholdTokenFrequency">.01</float>
  -->
  </lst>
  <!-- a spellchecker that can break or combine words.See "/spell" handler below for usage -->
  <lst name="spellchecker">
  <str name="name">wordbreak</str>
  <str name="classname">solr.WordBreakSolrSpellChecker</str>      
  <str name="field">name</str>
  <str name="combineWords">true</str>
  <str name="breakWords">true</str>
  <int name="maxChanges">10</int>
  </lst>
  </searchComponent>
  <!-- spellcheck component 的使用示例.
  

  NOTE: 这纯粹是一个例子.此处把 SpellCheckComponent 嵌入到 request handler 中是为了
  不需要多加一次spellcheck的请求
  See http://wiki.apache.org/solr/SpellCheckComponent for details
  on the request parameters.
  -->
  <requestHandler name="/spell" startup="lazy">
  <lst name="defaults">
  <!-- Solr will use suggestions from both the 'default' spellchecker
  and from the 'wordbreak' spellchecker and combine them.
  collations (re-written queries) can include a combination of
  corrections from both spellcheckers -->
  <str name="spellcheck.dictionary">default</str>
  <str name="spellcheck.dictionary">wordbreak</str>
  <str name="spellcheck">on</str>
  <str name="spellcheck.extendedResults">true</str>      
  <str name="spellcheck.count">10</str>
  <str name="spellcheck.alternativeTermCount">5</str>
  <str name="spellcheck.maxResultsForSuggest">5</str>      
  <str name="spellcheck.collate">true</str>
  <str name="spellcheck.collateExtendedResults">true</str>
  <str name="spellcheck.maxCollationTries">10</str>
  <str name="spellcheck.maxCollations">5</str>         
  </lst>
  <arr name="last-components">
  <str>spellcheck</str>
  </arr>
  </requestHandler>
页: [1]
查看完整版本: Solr 6.7学习笔记(06)