如何使用基于行的行在solr中插入多值字段

h9vpoimq  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(421)

我正在尝试将逗号分隔的字符串作为多值字段插入hbase中基于行的结构的morphline配置中。
有谁能给我一个更好的建议或体验吗?我是新手。
有什么办法我能做到吗。
hbase索引器Map器:

<?xml version="1.0"?>
<indexer table="Document_Test"
    mapper="com.ngdata.hbaseindexer.morphline.MorphlineResultToSolrMapper"
    unique-key-field="documentId" mapping="row">

    <param name="morphlineFile" value="/path/to/morphline.conf" />

</indexer>

变形线形态:

{
   extractHBaseCells {
             mappings : [
                           {
                              inputColumn : "CF:DocumentId"
                              outputField : documentId
                              type : long
                              source : value
                           }
                           {
                              inputColumn : "CF:Persons"
                              outputField : persons
                              type : string
                              source : value
                           }
                        ]
                    }

      // Some command here which can be used, I tried with**java**, But didn't worked and make it a single string

}

它只不过是把一根弦做成这样:

{
    "persons": [
      "[Panos Kammenos, King Salman, Nabil Sadek, Ehab Azmy, Hesham Abdelhamid]"
    ],
    "documentId": 38900223,
    "_version_": 1535233203724353500
  }

更新

尝试了这个方法,它可以用于基于行的Map或高层结构。

{
    extractHBaseCells {
        mappings : [
            {
                inputColumn : "CF:DocumentId"
                outputField : documentId
                type : long
                source : value
            }
            {
                inputColumn : "CF:Persons"
                outputField : persons
                type : string
                source : value
            }
        ]
    }
}
{
    split{
        inputField : persons
        outputField : persons_multi
        separator : ","
        isRegex : false
    }
}
bakd9h0s

bakd9h0s1#

可以按如下方式使用split命令:

{
    extractHBaseCells {
        mappings : [
            {
                inputColumn : "CF:DocumentId"
                outputField : documentId
                type : long
                source : value
            }
            {
                inputColumn : "CF:Persons"
                outputField : persons
                type : string
                source : value
            }
        ]
    }
}
{
    split{
        inputField : persons
        outputField : persons_multi
        separator : ","
        isRegex : false
    }
}

如果你遇到任何问题,请告诉我。

相关问题