组查询中的Solr错误

时间:2017-05-04 17:56:48

标签: 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"
          }
        ]
      }
    }
  }
}

“CIUDAD DE BUENOS AIRES”重复,另一个城市“VILLA ALBOROTO”遗失。

如果我推迟参数“group.format = simple”,我将获得此输出:

    {
  "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,任何人都知道如何正确执行此查询?感谢。

0 个答案:

没有答案