【问题标题】:Solr Indexing multiple json objectsSolr索引多个json对象
【发布时间】:2016-06-16 18:46:24
【问题描述】:

我正在尝试学习 solr,但一些技术细节让我感到困惑。 我有一个大文件,其结构基本上是这样的:

url -> {Some giant json object}
url -> {another giant json object}
...
url -> {another giant json object}

其中有近 30,000 个。 我想将它们索引到 solr。所以我创建了一个 schema.xml,它包含所有可能的字段,以及它是否被索引、多值等。

我想知道接下来要做什么的一般结构是什么。我知道我必须为文件编制索引,但我是否对每一行分别使用 curl 命令? 只是寻找对事物的更高层次的理解,因为在线资源对我来说有点混乱。

谢谢!

编辑—— 终端命令是索引这些特定类型文件的最快方法吗?我更新了示例以显示 json 文件的外观。

【问题讨论】:

    标签: solr


    【解决方案1】:

    卷曲请求

    curl 'http://localhost:8983/solr/collection1/update/json/docs'
    '?split=/exams'
    '&f=first:/first'
    '&f=last:/last'
    '&f=grade:/grade'
    '&f=subject:/exams/subject'
    '&f=test:/exams/test'
    '&f=marks:/exams/marks'
     -H 'Content-type:application/json' -d '
    

    这会将数据索引为

    {
      "first": "John",
      "last": "Doe",
      "grade": 8,
      "exams": [
          {
            "subject": "Maths",
            "test"   : "term1",
            "marks":90},
            {
             "subject": "Biology",
             "test"   : "term1",
             "marks":86}
          ]
    }'
    

    要了解更多信息,请点击此链接 -

    https://lucidworks.com/blog/2014/08/12/indexing-custom-json-data/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-09
      • 2013-12-17
      • 1970-01-01
      相关资源
      最近更新 更多