查找与定义的半径相交的Solr文档 [英] Finding Solr documents that intersect with a defined Radius

查看:93
本文介绍了查找与定义的半径相交的Solr文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Apache Solr 5.x,目前我们有很多定义的形状.多边形,圆形等.所有这些都对应于一个文档,每种形状的坐标都对应.

We are using Apache Solr 5.x, and we currently have a bunch of defined shapes. Polygons, Circles, etc. These all correspond to a document, each shape of coordinates does.

我想知道的是-是否可以提供一个circle,即-该圆的(lat,lng)对和Radius对-然后找到所有与那个圈子?

What I want to know is - is it possible to provide a circle, that is - a (lat,lng) pair along with a Radius for that circle - and then find all documents that have an intersection with that circle?

我尝试了多种选择,最近一次是这样:

I have tried a variety of options, most recently this one:

solr_index_wkt:"IsWithin(CIRCLE((149.39999999999998 -34.92 d=0.44964028776978415))) distErrPct=0.0"

但是,这将导致以下错误:

However, this results in the following error:

"msg": "Unknown Shape definition [CIRCLE((149.39999999999998 -34.92 d=0.44964028776978415))]",

真的迷住了这个.

更新

solr_index_wkt 是为索引文档中的多边形,圆形和填充物定义边界框"的字段.

the solr_index_wkt is the field that is defining the 'bounding boxes' for the polygons, circles and stuff on the indexed documents.

推荐答案

我遇到了一个非常相似的问题,我一直把头撞在键盘上,直到找到了这个小宝石.我确定您可能在schema.xml文件中使用了solr.SpatialRecursivePrefixTreeFieldType.您需要将格式属性设置为"LEGACY".然后它将在您的查询中识别出Circle!

I had a very similar problem and I kept banging my head against my keyboard until I found this little gem. I'm sure you're probably using solr.SpatialRecursivePrefixTreeFieldType in your schema.xml file. You need to set the format attribute to "LEGACY". It should then recognize Circle in your queries!

<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
       spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
       autoIndex="true"
       validationRule="repairBuffer0"
       format="LEGACY"
       distErrPct="0.025"
       maxDistErr="0.001"
       distanceUnits="miles" />

这篇关于查找与定义的半径相交的Solr文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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