Solrj 存储一个point类型的字段

59 篇文章 0 订阅
"这篇博客介绍了如何使用SolrJ库来存储Solr中的point类型字段,该字段类型为solr.PointType,适用于地理坐标索引。在managed-schema文件中定义了fieldType,并使用subFieldSuffix创建了动态字段。通过示例展示了向此类字段写入数据的格式,如`doc.setField("xy___complex","22.103,59.202");`"
摘要由CSDN通过智能技术生成

用Solrj 存储一个point类型的字段,其字段类型的class为 solr.PointType。

这是managed-schema文件中相应的一段:

<!-- This point type indexes the coordinates as separate fields (subFields)
      If subFieldType is defined, it references a type, and a dynamic field
      definition is created matching *___<typename>.  Alternately, if
      subFieldSuffix is defined, that is used to create the subFields.
      Example: if subFieldType="double", then the coordinates would be
        indexed in fields myloc_0___double,myloc_1___double.
      Example: if subFieldSuffix="_d" then the coordinates would be indexed
        in fields myloc_0_d,myloc_1_d
      The subFields are an implementation detail of the fieldType, and end
      users normally should not need to know about them.
     -->
<fieldType name="complex" class="solr.PointType" dimension="2" subFieldSuffix="_d" />

请注意上面的注释:

If subFieldType is defined, it references a type, and a dynamic field definition is created matching *___<typename>.

它指明了动态字段的构造格式。

通过SolrJ或SolrClient向此字段中写入数据的格式如下:

doc.setField("xy___complex", "22.103,59.202");

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值