从集合

时间:2015-11-23 10:11:50

标签: json solr

我想在上传一些初始数据后更新Solr建议词典(在Solr 5.3.1中)。删除所有数据并上传修改后的数据后,更新建议词典。但是当我删除任何特定记录(例如id = 123)时,建议者仍然会在结果集中返回已删除的记录。

例如,

  1. 我最初将以下json数据上传到mycollection:
  2. json_data.json

    [
        {
            "id": 1,
            "name": "New York"
        },
        {
            "id": 2,
            "name": "New Jersey"
        },
        {
            "id": 3,
            "name": "California"
        }
    ]
    

    使用此命令:

    curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/mycollection/update?commit=true' --data-binary @json_data.json
    
    1. 选择查询将返回以下内容:
    2. 本地主机:8983 / solr的/ MyCollection的/选择Q = %3A &安培;重量= JSON&安培;缩进=真

      {
          "responseHeader": {
              "status": 0,
              "QTime": 0,
              "params": {
                  "q": "*:*",
                  "indent": "true",
                  "wt": "json",
                  "_": "1448271522315"
              }
          },
          "response": {
              "numFound": 3,
              "start": 0,
              "docs": [
                  {
                      "id": "1",
                      "name": [
                          "New York"
                      ],
                      "_version_": 1518622755181822000
                  },
                  {
                      "id": "2",
                      "name": [
                          "New Jersey"
                      ],
                      "_version_": 1518622755186016300
                  },
                  {
                      "id": "3",
                      "name": [
                          "California"
                      ],
                      "_version_": 1518622755187064800
                  }
              ]
          }
      }
      
      1. 建议者为"新"返回以下内容字:
      2. 本地主机:8983 / solr的/ MyCollection的/建议Q =最新及安培;重量= JSON&安培;缩进=真

        {
            "responseHeader": {
                "status": 0,
                "QTime": 0
            },
            "spellcheck": {
                "suggestions": [
                    "New",
                    {
                        "numFound": 2,
                        "startOffset": 0,
                        "endOffset": 3,
                        "suggestion": [
                            "New Jersey",
                            "New York"
                        ]
                    }
                ],
                "collations": [
                    "collation",
                    "(New Jersey)"
                ]
            }
        }
        
        1. 现在我删除" New Jersey"使用以下命令从mycollection: curl http://localhost:8983/solr/mycollection/update?commit=true -H" Content-Type:text / xml" --data-binary'(id:2)'

        2. 现在,select query仅返回剩余的2条记录(已删除" New Jersey")

        3. 本地主机:8983 / solr的/ MyCollection的/选择Q = %3A &安培;重量= JSON&安培;缩进=真

          {
              "responseHeader": {
                  "status": 0,
                  "QTime": 0,
                  "params": {
                      "q": "*:*",
                      "indent": "true",
                      "wt": "json",
                      "_": "1448272061874"
                  }
              },
              "response": {
                  "numFound": 2,
                  "start": 0,
                  "docs": [
                      {
                          "id": "1",
                          "name": [
                              "New York"
                          ],
                          "_version_": 1518622755181822000
                      },
                      {
                          "id": "3",
                          "name": [
                              "California"
                          ],
                          "_version_": 1518622755187064800
                      }
                  ]
              }
          }
          
          1. 但建议查询仍然会返回"新泽西州"在结果集中
          2. 本地主机:8983 / solr的/ MyCollection的/建议Q =最新及安培;重量= JSON&安培;缩进=真

            {
                "responseHeader": {
                    "status": 0,
                    "QTime": 0
                },
                "spellcheck": {
                    "suggestions": [
                        "New",
                        {
                            "numFound": 2,
                            "startOffset": 0,
                            "endOffset": 3,
                            "suggestion": [
                                "New Jersey",
                                "New York"
                            ]
                        }
                    ],
                    "collations": [
                        "collation",
                        "(New Jersey)"
                    ]
                }
            }
            

            我在重新加载管理核心并重新启动solr服务器后尝试但结果保持不变。

            可能是什么问题?请问组件(solr.SpellCheckComponent)是否使用了缓存?如果是,可以如何清除?

            任何帮助都将不胜感激。

0 个答案:

没有答案