0
我需要使用solr進行地址搜索。我必須將國家和州列入城市搜索,但這裏我遇到了數據問題。組查詢中的Solr錯誤
與此查詢我獲得的所有城市的分組:
Query: country:"SPAIN" AND state:"MURCIA"
Field: city
Params: group=true&group.field=ciudadElectoral&group.format=simple
而且我得到這樣的:
{
"responseHeader": {
"status": 0,
"QTime": 3,
"params": {
"group.format": "simple",
"fl": "city",
"indent": "true",
"q": "country:\"SPAIN\" AND state:\"MURCIA\"",
"_": "1493920188445",
"group.field": "city",
"group": "true",
"wt": "json"
}
},
"grouped": {
"city": {
"matches": 80,
"doclist": {
"numFound": 80,
"start": 0,
"docs": [
{
"city": "CIUDAD DE BUENOS AIRES"
},
{
"city": "CIUDAD DE BUENOS AIRES"
},
{
"city": "VILLA MARTINEZ"
},
{
"city": "PALERMO"
}
]
}
}
}
}
「德城布宜諾斯艾利斯」是重複的,而另一個城市「別墅ALBOROTO」是失蹤。
如果我一拖再拖參數「group.format =簡單」,我獲得這樣的輸出:
{
"responseHeader": {
"status": 0,
"QTime": 2,
"params": {
"fl": "city",
"indent": "true",
"q": "country:\"SPAINT\" AND state:\"MURCIA\"",
"_": "1493920434726",
"group.field": "city",
"group": "true",
"wt": "json"
}
},
"grouped": {
"city": {
"matches": 80,
"groups": [
{
"groupValue": "de",
"doclist": {
"numFound": 5,
"start": 0,
"docs": [
{
"city": "CIUDAD DE BUENOS AIRES"
}
]
}
},
{
"groupValue": "buen",
"doclist": {
"numFound": 3,
"start": 0,
"docs": [
{
"city": "CIUDAD DE BUENOS AIRES"
}
]
}
},
{
"groupValue": "vill",
"doclist": {
"numFound": 2,
"start": 0,
"docs": [
{
"city": "VILLA MARTINEZ"
}
]
}
},
{
"groupValue": "palerm",
"doclist": {
"numFound": 70,
"start": 0,
"docs": [
{
"city": "PALERMO"
}
]
}
}
]
}
}
}
我可以看到「groupValue」有一個奇怪的值,而不是場外的完整的價值。我認爲這是問題。
我的太陽能版本是4.10,任何人都知道如何正確地執行此查詢?謝謝。
謝謝,我在文檔中看到這種情況(我是SOLR中的新成員)。觸摸這可能是乏味的,最後我將其更改爲Oracle Query。 – Ildelian
不是。你只需要它作爲一個字符串字段。您可以使用copyField指令將其複製到用於分組的單獨字段中。這就像你的模式中的兩個語句。 – MatsLindh