【问题标题】:Solr suggester in SolrCloud modeSolrCloud 模式下的 Solr 建议器
【发布时间】:2015-08-17 08:21:00
【问题描述】:

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

<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>

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

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。

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

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

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

【问题讨论】:

    标签: solr lucene solr4j


    【解决方案1】:

    因为 solr 在 SolrCloud 模式下运行,所以它不起作用。 solrCloud 模式下建议有两种方式:

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

        <bool name="distrib">false</bool> 
      
    • 使用 shardsshards.qt 参数搜索所有分片。 shards 参数将包含您要包含在查询中的所有分片的逗号分隔列表。 shards.qt 参数将定义您要访问的 reat API。

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

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

    详情请查看Here

    【讨论】:

    • 谢谢,能够解决将 shards.qt 添加到默认查询参数的问题。
    猜你喜欢
    • 1970-01-01
    • 2015-12-05
    • 1970-01-01
    • 2013-12-27
    • 2016-08-30
    • 2021-11-17
    • 2014-06-22
    • 2013-04-05
    • 1970-01-01
    相关资源
    最近更新 更多