gpt4 book ai didi

mysql - Solr DataImportHandler 与地理字段相关的问题

转载 作者:行者123 更新时间:2023-11-29 18:35:37 26 4
gpt4 key购买 nike

我在尝试使用 DataImportHandler 从 MySQL 导入位置数据时遇到问题。对我的子实体之一的查询是:

SELECT [...] AS data, AsText(data_geo) AS data_geo FROM [table] WHERE [conditions]

我已运行查询并验证输出看起来正确:

'128 Wall St, New Haven, CT 06511, USA', 'POINT(-72.92847010000003 41.31160920000001)'

但是,当我尝试运行导入时,出现以下异常:

SolrWriter.upload(73) | Error creating document : SolrInputDocument(fields: [[...], data=128 Wall St, New Haven, CT 06511, USA, data_geo=[B@23bcddc0, _version_=1573858358394355712])
org.apache.solr.common.SolrException: Point must be in 'lat, lon' or 'x y' format: [B@23bcddc0
at org.apache.solr.util.SpatialUtils.parsePointSolrException(SpatialUtils.java:113)
at org.apache.solr.schema.AbstractSpatialFieldType.parseShape(AbstractSpatialFieldType.java:239)
at org.apache.solr.schema.AbstractSpatialFieldType.createFields(AbstractSpatialFieldType.java:201)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:48)
at org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:123)
at org.apache.solr.update.AddUpdateCommand.getLuceneDocument(AddUpdateCommand.java:83)
at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:237)
at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:163)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:955)
at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1110)
at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:706)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:104)
at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:71)
at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:259)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:524)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414)
at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329)
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:461)
Caused by: com.spatial4j.core.exception.InvalidShapeException: Point must be in 'lat, lon' or 'x y' format: [B@23bcddc0
at org.apache.solr.util.SpatialUtils.parsePoint(SpatialUtils.java:74)
at org.apache.solr.util.SpatialUtils.parsePointSolrException(SpatialUtils.java:108)
... 22 more

schema.xml中的相关配置为:

   <field name="data_geo" type="location_rpt" indexed="true" stored="true" multiValued="false" />

<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
autoIndex="true"
geo="true"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />

我正在运行 Solr 5.2.1

知道为什么它尝试使用看似 Java 对象哈希的内容导入地理字段吗?

谢谢!

最佳答案

我在 Solr 常见问题解答中找到了解决方案:

https://wiki.apache.org/solr/DataImportHandlerFaq#line-92

我必须将 AsText 的输出转换为 CHAR,尽管该文档还提供了另外两个解决方案。

关于mysql - Solr DataImportHandler 与地理字段相关的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45331525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com