在 solr dih 在一个位置导入两个双精度 [英] In solr dih import two double in one location

查看:20
本文介绍了在 solr dih 在一个位置导入两个双精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在拥有的是两个双字段:

What I have now is the two double filds:

<field name="x_geo_x_coordinate" type="double" indexed="true" stored="true" default="0"/> 
<field name="x_geo_y_coordinate" type="double" indexed="true" stored="true" default="0"/>

以及我想要的:一个位置字段中的 2 个双精度值:

and what I want: the 2 double value in one location field:

<field name="x_geo" type="location" indexed="true" stored="true" default="0.0,0.0"/>

到目前为止我尝试过但不起作用:

What I tried so far and does't work:

<copyField source="*_coordinate" dest="x_geo"/>
<copyField source="x_geo_str" dest="x_geo"/>

任何简单的解决方案?提前致谢!

Any simple solution? Thanks in advance!

推荐答案

好吧,你在哪里,@nikhil500.ScriptTransformer 是一个答案,(我不确定这是否是最简单的).dataconfig.xml 包含一个 java 函数:

Well, you where right @nikhil500. ScriptTransformer is one answer, (I'm not sure if this is the simpliest). The dataconfig.xml contains a java function:

<script><![CDATA[
            function puttwodouble(row)        {
                var attrVal1 = row.get("GEO_X_WERT");
                var attrVal2 = row.get("GEO_Y_WERT");
                var attrVal = attrVal1 + "," + attrVal2;
                var arr = new java.util.ArrayList()
                arr.add(attrVal1);
                arr.add(attrVal2);
                row.put("store",attrVal);
                row.put("x_geo_str",arr);  
                return row;
            }
]]>

witch 将被调用:

whitch will be called:

 <entity name="inner_geo_str" transformer="script:puttwodouble"
            query="select GEO_X_WERT, GEO_Y_WERT from FIRMA_GEODATEN where GEO_FIR_NR ='${outer.FIR_NR}' and geo_x_wert != 'NF'">                     
                  <field column="GEO_X_WERT" name="x_geo_x_s"/> 
                  <field column="GEO_Y_WERT" name="x_geo_y_s"/>                     
          </entity>

希望能帮助其他人解决此类问题.

Hope that will help others to solve this kind of problem.

这篇关于在 solr dih 在一个位置导入两个双精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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