Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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
solr suggester不返回任何结果_Solr_Spell Checking_Autosuggest - Fatal编程技术网

solr suggester不返回任何结果

solr suggester不返回任何结果,solr,spell-checking,autosuggest,Solr,Spell Checking,Autosuggest,我在solr wiki上为suggester写了一篇文章,几乎到了这里:。我的solrconfig.xml中有以下xml: <searchComponent class="solr.SpellCheckComponent" name="suggest"> <lst name="spellchecker"> <str name="name">suggest</str> <str name="classname

我在solr wiki上为suggester写了一篇文章,几乎到了这里:。我的solrconfig.xml中有以下xml:

<searchComponent class="solr.SpellCheckComponent" name="suggest"> 
     <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">description</str> 
     <float name="threshold">0.05</float> 
     <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.count">5</str> 
     <str name="spellcheck.collate">true</str> 
   </lst> 
   <arr name="components"> 
     <str>suggest</str> 
   </arr> 
</requestHandler> 
我只返回以下结果xml:

<response>
   <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">78</int>
   </lst>
   <lst name="spellcheck">
      <lst name="suggestions"/>
   </lst>
</response>

0
78

正如你所看到的,这不是很有帮助。有什么建议可以帮助解决这个问题吗?

如果在schema.xml中设置了术语参数,请检查,如:

<field name="TEXT" type="text_en" indexed="true" stored="true" multiValued="true" 
                   termVectors="true"
                   termPositions="true"
                   termOffsets="true"/>


…重新启动solr并重新编制索引

我可以想到一些可能导致此问题的事情:

  • 源字段(“说明”)不正确-请确保这确实是为拼写检查器播种术语的字段。该字段甚至可能是另一种情况(例如,“Description”而不是“Description”)

  • schema.xml中的源字段设置不正确,或者正在由导致源字典无效的筛选器处理。我使用一个单独的字段作为字典的种子,并使用
    将相关的其他字段复制到字典中

  • 术语“烧烤”至少在5%的记录中没有出现(您已通过包含
    0.05
    )表明了这一要求),因此不包括在查找词典中

  • 在SpellCheckComponent中,
    true
    设置意味着只有能够产生更多结果的术语才会作为建议返回。根据Suggester文档,这有一个不同的功能(按权重对建议进行排序),但可能值得将其切换为false,以查看它是否导致了问题

my schema.xml的相关部分:

<schema>
    <types>
        <!-- Field type specifically for spell checking -->
        <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>
    </types>
    <fields>
        <field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true" />
    </fields>

    <!-- Copy fields which are used to seed the spell checker -->
    <copyField source="name" dest="spell" />
    <copyField source="description" dest="spell" />
<schema>

问题可能是您查询的是
/suggest
而不是
/spell


../suggest/?q=烧烤

在我的设置中,这是我传入的字符串:


/solr/spell?q=烧烤和拼写检查=正确和拼写检查。collate=正确

第一次进行拼写检查时,需要包括


&拼写检查.build=true


顺便说一句,我在Solr4上运行。所以,也许/suggest是一个完全不同的端点,它做了其他的事情。如果是,请道歉。

我在现有的术语参数中添加了termVectors=“true”、termPositions=“true”和termOffsets=“true”(其他所有内容都是相同的),但它仍然返回与上述相同的结果。您重新启动并重新编制索引了吗?您确定字段类型定义不会覆盖这些设置吗?可能没有建议?是的,我重新启动并重新索引了。我不相信它被覆盖了。我知道有很多产品可以通过/select查询完美地返回。是否有办法再次检查建议是否存在?另外,我也尝试了合并这个拼写检查方法:。同样的事情-拼写检查节点中没有返回结果。@BNDR您能解释为什么需要术语参数吗?我认为这是不对的。Thanks@TheBndr我还想知道为什么需要术语参数?因为我也面临类似的问题。你能详细说明一下吗:根据Suggester文档,这有一个不同的功能(按权重排序建议),但可能值得将其切换为false,以查看是否是导致问题的原因。
<schema>
    <types>
        <!-- Field type specifically for spell checking -->
        <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>
    </types>
    <fields>
        <field name="spell" type="textSpell" indexed="true" stored="false" multiValued="true" />
    </fields>

    <!-- Copy fields which are used to seed the spell checker -->
    <copyField source="name" dest="spell" />
    <copyField source="description" dest="spell" />
<schema>