Solr 解决方案:拼写检查无法使用select查询

Solr 解决方案:拼写检查无法使用select查询,solr,Solr,在SOLR admin中,我们可以看到有一个拼写检查选项,但它没有显示结果 这是如何使用select查询的 如果我直接用拼写URL搜索,它会给我预期的结果 结果 { "responseHeader":{ "status":0, "QTime":8}, "response":{"numFound":0,"start":0,"docs":[] }, "spellcheck":{ "suggestions":[ "blakc",{

在SOLR admin中,我们可以看到有一个拼写检查选项,但它没有显示结果

这是如何使用select查询的

如果我直接用拼写URL搜索,它会给我预期的结果

结果

{
  "responseHeader":{
    "status":0,
    "QTime":8},
  "response":{"numFound":0,"start":0,"docs":[]
  },
  "spellcheck":{
    "suggestions":[
      "blakc",{
        "numFound":10,
        "startOffset":0,
        "endOffset":5,
        "origFreq":0,
        "suggestion":[{
            "word":"black",
            "freq":65146},
          {
            "word":"blanc",
            "freq":151},
          {
            "word":"blake",
            "freq":10},
          {
            "word":"blac",
            "freq":2},
          {
            "word":"block",
            "freq":1863},
          {
            "word":"blanca",
            "freq":32},
          {
            "word":"blank",
            "freq":31},
          {
            "word":"blade",
            "freq":23},
          {
            "word":"blacks",
            "freq":12},
          {
            "word":"blanco",
            "freq":11}]}],
    "correctlySpelled":false,
    "collations":[]}}
但是我需要与select查询相同的结果,该查询在SOLR admin中不起作用

Solrconfig.xml

<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
    <str name="queryAnalyzerFieldType">text_general</str>
    <!-- Multiple "Spell Checkers" can be declared and used by this
         component
      -->
    <!-- a spellchecker built from a field of the main index -->
    <lst name="spellchecker">
      <str name="name">default</str>
      <str name="field">Name</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>
</searchComponent>

<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
      <str name="spellcheck.dictionary">default</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>

正文\u概述
违约
名称
solr.DirectSolrSpellChecker
内部的
0.5
2.
1.
5.
4.
0.01
违约
在…上
真的
10
5.
5.
真的
真的
10
5.


是否有任何设置和步骤需要完成?

尝试将拼写检查组件添加到标准查询处理程序中,如

<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <int name="rows">10</int>

    <str name="spellcheck">on</str>
      <str name="spellcheck.extendedResults">true</str>
      <str name="spellcheck.count">10</str>
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>
</requestHandler>
此外,在使用拼写检查词典之前,不要忘记构建它:

http://localhost:8983/solr/select/?q=*:*&spellcheck=true&spellcheck.build=true
尝试将拼写检查添加到请求处理程序中
http://localhost:8983/solr/select/?q=*:*&spellcheck=true&spellcheck.build=true