如何使用百合morphline行为基础在solr中插入多值场 [英] How to insert multivalued field in solr using lily morphline row-based

查看:475
本文介绍了如何使用百合morphline行为基础在solr中插入多值场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以提出任何建议。任何人都可以提出任何建议更好的方式或经验我是新来的。



有没有什么办法可以做到这一点。



HBase -Indexer Mapper:

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

< param name =morphlineFilevalue =/ path / to / morphline.conf/>

< / indexer>

Morphline Conf:

  {
extractHBaseCells {
mappings:[
{
inputColumn:CF:DocumentId
outputField:documentId
type:long
source:value

{
inputColumn:CF:Persons
outputField:persons
type:string
source:value
}
]
}

//在这里可以使用的一些命令,我​​用** java **尝试过,但是没有成功并使它成为一个单个字符串

}

它只是像这样制作一个字符串:

  {
persons:[
[Panos Kammenos,King Salman,Nabil Sadek,Ehab Azmy,Hesham Abdelhamid]

documentId:38900223,
_version_:1535233203724353500
}



已更新



试过这个,它适用于基于行的映射或高层结构。


$ b $

  {
extractHBaseCells {
mappings:[
{
inputColumn:CF:DocumentId
outputField:documentId
类型:long
source:value
}
{
inputColumn:CF:Persons
outputField:persons
类型:字符串
源:值
}
]
}
}
{
split {
inputField:人
outputField:persons_multi
分隔符:,
isRegex:false
}
}


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

让我知道您是否遇到任何问题。

I am trying to insert a comma-seperated string as a multivalued field to my morphline configuration from a Row-based Structure in HBase.

Can any one suggest any better way or experience I am new to this.

Is there any way I can do that.

HBase-Indexer Mapper:

<?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>

Morphline Conf:

{
   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

}

It is just making a single string like this :

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

UPDATED

Tried this one and It worked on Row-Based mappings or Tall structure.

     {
    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
    }
}

解决方案

You can use split command as follows:

{
    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
    }
}

Let me know if you encounter any problem.

这篇关于如何使用百合morphline行为基础在solr中插入多值场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆