我使用solr快速搜索所需的數據,並通過簡單的查詢獲取多個相關數據。SOLR:多個相關數據字段的搜索查詢
我需要一個查詢相關數據,
這裏確切的情況。
猜測,有3種不同類型的數據type:"A"
,type:"B"
的,type:"C"
type:"A"
是type:"B"
和type:"B"
父type:"C"
猜測的父type:"A"
已100個數據,type:"B"
具有200個數據,type:"C"
具有400數據
[
{
"id": "1",
"name": "x",
"type": "A"
},
{
"id": "2",
"name": "y",
"type": "A"
},
{
"id": "3",
"name": "z",
"type": "A"
},
{
"id": "10",
"name": "xy",
"type": "B",
"parentID": "1"
},
{
"id": "11",
"name": "yz",
"type": "B",
"parentID": "1"
},
{
"id": "1a34",
"name": "zwse",
"type": "C",
"parentID": "10"
},
{
"id": "1zdfb",
"name": "xgbdrt",
"type": "C",
"parentID": "11"
},
{
"id": "13",
"name": "yyhny",
"type": "B",
"parentID": "2"
},
{
"id": "1srtbr",
"name": "zrstbrth",
"type": "B",
"parentID": "2"
}
]
你可以在這裏看到「id」type:"A"
是type:"B"
的「parentID」,類似地,type:"B"
的「id」是「parentID」type:"C"
。
在此JSON,你可以看到對方, 類型如何對象相關的: 「A」
{
"id": "1",
"name": "x",
"type": "A"
}
是類型的家長: 「B」
{
"id": "10",
"name": "xy",
"type": "B",
"parentID": "1"
},
{
"id": "11",
"name": "yz",
"type": "B",
"parentID": "1"
}
和類型: 「B」 是
{
"id": "10",
"name": "xy",
"type": "B",
"parentID": "1"
}
類型的父: 「C」
{
"id": "1a34",
"name": "zwse",
"type": "C",
"parentID": "10"
}
我需要Solr中這樣的查詢在哪裏可以找到類型: 「A」,並有相關的數據
結果應該包含
type:"A" data > type :"B" data which "parentID"s are related to type:"A" "id"s > type :"C" data which "parentID"s are related to type:"B" "id"s
像
[
{
"id": "1",
"name": "x",
"type": "A"
},
{
"id": "10",
"name": "xy",
"type": "B",
"parentID": "1"
},
{
"id": "11",
"name": "yz",
"type": "B",
"parentID": "1"
},
{
"id": "1a34",
"name": "zwse",
"type": "C",
"parentID": "10"
},
{
"id": "1zdfb",
"name": "xgbdrt",
"type": "C",
"parentID": "11"
}
]
你能幫我嗎,我怎樣才能得到這種類型的相關數據?
我已經通過了所有查詢解析器,但沒有得到任何有用的這種類型的結果。 你能告訴我嗎?如果我錯過任何,可以工作得到這種類型的結果。
在此先感謝