我在 solr 查询中使用了组,结果如下。
{
"responseHeader":{
"status":0,
"QTime":157,
"params":{
"q":"name:Abcd",
"hl":"true",
"hl.simple.post":"</em>",
"indent":"true",
"group.limit":"-1",
"hl.fl":"id,address",
"rows":"332",
"wt":"json",
"hl.simple.pre":"<em>",
"group.field":"uid",
"group":"true"}},
"grouped":{
"sdn_uid":{
"matches":10,
"groups":[
{
"groupValue":"726",
"doclist":{"numFound":5,"start":0,"docs":[
{
"address":"Bahia Ignacio #1921",
"uid":"726",
"idnumber":"ZAGI-500130",
"id":"140",
"name":"El ZAMBADA",
"_version_":1584841227872763908},
{
"address":"Bahia Ignacio #1921",
"uid":"726",
"idnumber":"ZAGI-500130",
"id":"141",
"name":"Ismael ZAMBADA GARCIA",
"_version_":1584841227872763909},
{
"address":"Bahia Ignacio #1921",
"uid":"726",
"idnumber":"ZAGI-500130",
"id":"142",
"name":"LOAIZA AVENDANO",
"_version_":1584841227872763910},
{
"address":"Bahia Ignacio #1921",
"uid":"726",
"idnumber":"ZAGI-500130",
"id":"143",
"name":"Javier GARCIA HERNANDEZ",
"_version_":1584841227873812480},
{
"address":"Bahia Ignacio #1921",
"uid":"726",
"idnumber":"ZAGI-500130",
"id":"144",
"name":"Ismael RENTERIA",
"_version_":1584841227873812481}
]}]}
Here grouping is based on uid. But I need the result as follows :
"doclist":{"numFound":5,"start":0,"docs":[
{
"address":["Bahia Ignacio #1921","Bahia Ignacio #1921","Bahia Ignacio #1921","Bahia Ignacio #1921","Bahia Ignacio #1921"]
"uid":["726","726","726","726","726"]
"idnumber":["ZAGI-500130","ZAGI-500130","ZAGI-500130","ZAGI-500130","ZAGI-500130"]
"id":["141","142","143","144","145"]
"name":["El ZAMBADA","Ismael ZAMBADA GARCIA","LOAIZA AVENDANO","Javier GARCIA HERNANDEZ","Ismael RENTERIA"]
"_version_":[1584841227872763908,1584841227872763909,1584841227872763910,1584841227873812480,1584841227872763908]}
]}
即在组内发现的结果必须以数组排列,而不是单独显示。
有没有办法实现这个目标?