【问题标题】:Solr json.facet terms type not working for multivalued string fieldSolr json.facet 术语类型不适用于多值字符串字段
【发布时间】:2021-02-22 04:06:37
【问题描述】:

我在 Solr 中有一个多值字段,尝试为该字段返回 terms 方面没有产生任何结果。

<fieldType name="industries_text" 
    class="solr.TextField" positionIncrementGap="100" 
    multiValued="true">

<field name="industries" type="industries_text" 
    sortMissingLast="true" indexed="true" stored="true" 
    multiValued="true" uninvertible="false" 
    omitPositions="true" />
"json.facet": {
    industries: {
       type: "terms",
       field: "industries",
       missing: true,
    }
}

这会返回:

"industries": {
  "missing": {
    "count": 0
  },
  "buckets": []
}

然而,当我查询所有文档时,返回了 industries: ["industry1", "industry2"],因此它们编入索引。

【问题讨论】:

    标签: solr


    【解决方案1】:

    您明确告诉 Solr 您不希望该字段不反转。这是能够创建构面的要求。

    uninvertible="false" 交换为 uninvertible="true" 或将其保留为默认值 (true)。

    你想设置uninvertible="false" 如果字段支持 docValues 并且它们已启用。 TextFields 不支持 docValues,因此如果您打算将其用于任何需要不倒置结构的操作(例如 Faceting),则它必须是不倒置的。

    【讨论】:

    • 谢谢!我花了几天时间调试它,并没有注意到它被设置为 false。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-04
    • 2013-04-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多