SolrCloud 模式下的 Solr 建议器 [英] Solr suggester in SolrCloud mode

查看:20
本文介绍了SolrCloud 模式下的 Solr 建议器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 CloudSolr 模式下使用三个分片运行 solr.数据已经被索引到 solr 中.现在我已经在 solrconfig.xml 中配置了 solr 建议器.这是来自 solrconfig 文件的配置.我使用的是 solr 4.10 版本.

I am running the solr in CloudSolr mode with three shards. The data is already indexed into solr. Now I have configured the solr suggester in solrconfig.xml. This is the configuration from solrconfig file. I am using solr 4.10 version.

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">mysuggest</str>
        <str name="lookupImpl">FuzzyLookupFactory</str>
        <str name="storeDir">suggester_fuzzy_dir</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">businessName</str>
        <str name="payloadField">profileId</str>
        <str name="weightField">businessName</str>
        <str name="suggestAnalyzerFieldType">text_general</str>
        <str name="buildOnStartup">false</str>
    </lst>
</searchComponent>

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
        <str name="suggest">true</str>
        <str name="suggest.count">10</str>
    </lst>
    <arr name="components">
        <str>suggest</str>
    </arr>
</requestHandler>

这是我用来获取结果的命令:

Here is the command I am using to fetch the result:

http://shard1:8900/solr/core/suggest?suggest=true&suggest.build=true&suggest.reload&suggest.dictionary=mysuggest&wt=json&indent=true&suggest.q=sale

这是命令的输出:

{
"responseHeader":{
"status":0,
"QTime":1490},
"command":"build",
"suggest":{}
}

没有任何内容进入建议结果.我有 10K 条记录索引到 solr 中.

Nothing is coming into suggest result. I have 10K records indexed into solr.

我在日志文件中看到以下内容:

I am seeing the following into log file:

org.apache.solr.handler.component.SuggestComponent; http://shard1:8983/solr/core/ : null
org.apache.solr.handler.component.SuggestComponent; http://shard2:8900/solr/core/ : null
org.apache.solr.handler.component.SuggestComponent; http://shard3:7574/solr/core/ : null

我无法理解这里缺少什么.谢谢.

I am not able understand what is missing here. Thanks.

推荐答案

它无法正常工作,因为 solr 在 SolrCloud 模式下运行.在 solrCloud 模式下执行建议有两种方式:

It was not working because solr was running in SolrCloud mode. There is two ways to perform suggestion in solrCloud mode:

  • 使用 distrib=false 参数.这将仅从您在命令中访问的一个分片中获取数据.您可以将以下内容添加到组件定义本身中.

  • Use the distrib=false parameter. This will fetch the data from only one shard which you are accessing in the command. You can add the following into Component definition itself.

  <bool name="distrib">false</bool> 

  • 使用 shardsshards.qt 参数搜索所有分片.shards 参数将包含要包含在查询中的所有分片的逗号分隔列表.shards.qt 参数将定义您要访问的 reat API.

  • Use the shards and shards.qt parameter for searching all the shards. The shards parameter will contain comma separated list of all the shards which you want to include in the query. The shards.qt parameter will define the reat API you want to access.

    shards.qt: 向 Solr 发出信号,表明对分片的请求应发送到此参数给出的请求处理程序.如果您的请求处理程序是/spell",则在发出请求时使用 shards.qt=/spell.

    shards.qt: Signals Solr that requests to shards should be sent to a request handler given by this parameter. Use shards.qt=/spell when making the request if your request handler is "/spell".

    shards: shards=solr-shard1:8983/solr,solr-shard2:8983/solr 分布式搜索

    shards: shards=solr-shard1:8983/solr,solr-shard2:8983/solr Distributed Search

    请查看此处了解更多详情.

    这篇关于SolrCloud 模式下的 Solr 建议器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆