1

我有schema.xml以下几点:

<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"/>
<field name="x_geo" type="location" indexed="true" stored="true" default="0.0,0.0"/>

我设法从数据库中导入纬度,只要字符串:

<field name="x_geo_x_str_coordinate_s" type="string" indexed="true" stored="true" default="0"/>
<field name="x_geo_y_str_coordinate_s" type="string" indexed="true" stored="true" default="0"/>
<field name="x_geo_str" type="string" indexed="true" stored="true" multiValued="true" default="0,0"/>

如何使用简单的解决方案将 2 个刺痛复制/转换为双倍?

更新 1: 好的,从字符串到双精度的转换工作正常,非常感谢您的解决方案!我现在拥有的是两个双重领域:

<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 个双精度值:

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

到目前为止我尝试过并且不起作用的方法:

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

有什么简单的解决办法吗?提前致谢!

4

1 回答 1

1

您可以在 schema.xml 文件中使用 copyField,如下所示:

  <copyField source="x_geo_x_str" dest="x_geo_x_coordinate"/>
  <copyField source="x_geo_y_str" dest="x_geo_y_coordinate"/>
  <copyField source="x_geo_str" dest="x_geo"/>
于 2011-11-14T13:34:40.787 回答