gpt4 book ai didi

Solr 刻面 : Inconsistent JSON formatting

转载 作者:行者123 更新时间:2023-12-03 23:52:31 27 4
gpt4 key购买 nike

我的 solr 架构中有以下两个字段:

<field name="brand_id"     type="string" indexed="true" stored="true" />
<field name="category_id" type="string" indexed="true" stored="true" />

当我在启用 facet 的情况下发出请求(faceting on brand_id)
http://example.com/solr/select?wt=json&facet=true&facet.mincount=1&facet.field=brand_id&q= * :*

分面输出以对象表示法返回:
"facet_counts": {
"facet_queries": { }
"facet_fields": {
"brand_id": [
{"1350492":14},
{"1350578":12},
{"1350600":11},
{"1350617":8}
]
}
}

但是,使用“category_id”作为构面字段重复相同的请求会返回数组表示法
http://example.com/solr/select?wt=json&facet=true&facet.mincount=1&facet.field=category_id&q= * :*
"facet_counts":{
"facet_queries":{},
"facet_fields":{
"category_id":[
"230",20,
"259",13,
"154",12,
"249",11
]
}
}

有没有办法强制对象符号格式?我正在使用 Solr 3.6

-- 更新 --

使用 XML 格式返回正确的结果:
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="brand_id">
<int name="269115">136</int>
<int name="269394">110</int>
</lst>


<lst name="category_id">
<int name="1348814">228</int>
<int name="1350591">218</int>
</lst>

最佳答案

正如 Bill Dueber 所提到的,您可以使用 json.nl 参数格式化 JSON 输出。查看此页面,https://wiki.apache.org/solr/SolJSON#JSON_specific_parameters

关于Solr 刻面 : Inconsistent JSON formatting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13899724/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com