Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search Solr-示例拼写检查器不工作_Search_Solr_Spell Checking - Fatal编程技术网

Search Solr-示例拼写检查器不工作

Search Solr-示例拼写检查器不工作,search,solr,spell-checking,Search,Solr,Spell Checking,我已经为Solr附带的示例安装配置设置了拼写检查器。我已经按照他们对拼写检查器的说明进行了如下操作:[http://wiki.apache.org/solr/SpellCheckComponent][1] 我的问题是,在完全遵循它之后,我仍然无法让它工作 构建时的响应(http://localhost:8983/solr/spell?q=:&spellcheck.build=true&spellcheck.q=delll%20ultrashar&spellcheck=true) 情况如下: &l

我已经为Solr附带的示例安装配置设置了拼写检查器。我已经按照他们对拼写检查器的说明进行了如下操作:[http://wiki.apache.org/solr/SpellCheckComponent][1]

我的问题是,在完全遵循它之后,我仍然无法让它工作

构建时的响应(http://localhost:8983/solr/spell?q=:&spellcheck.build=true&spellcheck.q=delll%20ultrashar&spellcheck=true)

情况如下:

<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">14</int>
    </lst>
        <str name="command">build</str>
        <result name="response" numFound="17" start="0">
        ...
        </result>
        <lst name="spellcheck">
        <lst name="suggestions"/>
    </lst>
</response>

0
14
建造
...
当我查询时:&spellcheck.q=dell+ultrashar&spellcheck=true&spellcheck.extendedResults=true

我得到以下回应

<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">1</int>
    </lst>
    <result name="response" numFound="17" start="0">
    ...
    </result>
    <lst name="spellcheck">
        <lst name="suggestions">
        <bool name="correctlySpelled">false</bool>
        </lst>
    </lst>
</response>

0
1.
...
假的
有什么好处?我的schema.xml中是否缺少某些内容

schema.xml如下所示:

solrConfig.xml如下所示:

对示例文件的唯一更改是在solrconfig.xml中添加了以下内容:

 <searchComponent name="spellcheck" class="solr.SpellCheckComponent">

  <lst name="spellchecker">
    <!--
        Optional, it is required when more than one spellchecker is configured.
        Select non-default name with spellcheck.dictionary in request handler.
    -->
    <str name="name">default</str>
    <!-- The classname is optional, defaults to IndexBasedSpellChecker -->
    <str name="classname">solr.IndexBasedSpellChecker</str>
    <!--
        Load tokens from the following field for spell checking,
        analyzer for the field's type as defined in schema.xml are used
    -->
    <str name="field">spell</str>
    <!-- Optional, by default use in-memory index (RAMDirectory) -->
    <str name="spellcheckIndexDir">./spellchecker</str>
    <!-- Set the accuracy (float) to be used for the suggestions. Default is 0.5 -->
    <str name="accuracy">0.7</str>
    <!-- Require terms to occur in 1/100th of 1% of documents in order to be included in the dictionary -->
    <float name="thresholdTokenFrequency">.0001</float>
  </lst>
  <!-- Example of using different distance measure -->
  <lst name="spellchecker">
    <str name="name">jarowinkler</str>
    <str name="field">lowerfilt</str>
    <!-- Use a different Distance Measure -->
    <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
    <str name="spellcheckIndexDir">./spellchecker</str>

  </lst>

  <!-- This field type's analyzer is used by the QueryConverter to tokenize the value for "q" parameter -->
  <str name="queryAnalyzerFieldType">textSpell</str>
</searchComponent>
<!--
    The SpellingQueryConverter to convert raw (CommonParams.Q) queries into tokens.  Uses a simple regular expression
    to strip off field markup, boosts, ranges, etc. but it is not guaranteed to match an exact parse from the query parser.

Optional, defaults to solr.SpellingQueryConverter
-->
<queryConverter name="queryConverter" class="solr.SpellingQueryConverter"/>

<!--  Add to a RequestHandler
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     NOTE:  YOU LIKELY DO NOT WANT A SEPARATE REQUEST HANDLER FOR THIS COMPONENT.  THIS IS DONE HERE SOLELY FOR
     THE SIMPLICITY OF THE EXAMPLE.  YOU WILL LIKELY WANT TO BIND THE COMPONENT TO THE /select STANDARD REQUEST HANDLER.
     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-->
<requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
  <lst name="defaults">
    <!-- Optional, must match spell checker's name as defined above, defaults to "default" -->
    <str name="spellcheck.dictionary">default</str>
    <!-- omp = Only More Popular -->
    <str name="spellcheck.onlyMorePopular">false</str>
    <!-- exr = Extended Results -->
    <str name="spellcheck.extendedResults">false</str>
    <!--  The number of suggestions to return -->
    <str name="spellcheck.count">1</str>
  </lst>
  <!--  Add to a RequestHandler
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       REPEAT NOTE:  YOU LIKELY DO NOT WANT A SEPARATE REQUEST HANDLER FOR THIS COMPONENT.  THIS IS DONE HERE SOLELY FOR
       THE SIMPLICITY OF THE EXAMPLE.  YOU WILL LIKELY WANT TO BIND THE COMPONENT TO THE /select STANDARD REQUEST HANDLER.
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  -->
  <arr name="last-components">
    <str>spellcheck</str>
  </arr>
</requestHandler>

违约
solr.IndexBasedSplletChecker
拼写
/拼写检查
0.7
.0001
加洛温克勒
低过滤
org.apache.lucene.search.spell.JaroWinklerDistance
/拼写检查
文字拼写
违约
假的
假的
1.
拼写检查

文本拼写字段定义位于错误的位置。以下片段应位于
schema.xml
中的
types
标记中:

<fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" omitNorms="true">
    <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StandardFilterFactory"/>
    </analyzer>
    <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true"  expand="true"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StandardFilterFactory"/>
    </analyzer>
</fieldType>


在您解决了这个问题之后,我想一切都应该正常,但我建议您对示例进行一点清理,因为它基本上包含了您可以配置的所有内容。您应该保留您真正需要的内容。

请将
solrconfig.xml
schema.xml
的相关部分粘贴到此处。以下是指向这两个部分的链接。此处的字符限制为很少可粘贴。-->我所做的唯一更改是solrconfig.xml,它在底部以右开始。我注意到链接的
solrconfig.xml
与您问题中粘贴的不同。你用哪一种?也许你应该保留这个问题。谢谢Javanna,我按照你上面所说的更正了我的文档。这是问题之一。然而,我遇到了另一个问题-那就是生成查询无法生成??为了解决这个问题,我必须在searchComponent中包含true。有人知道生成查询失败的原因吗?您在日志文件中发现错误了吗?这很奇怪,因为索引是以同样的方式构建的。你改变的是它建成的那一刻。以前它是手动构建的,实际上它是在每次提交后自动构建的。