lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanders, Marshall (CAI - Atlanta)" <Marshall.Sande...@coxautoinc.com>
Subject Solr Geospatial Polygon Indexing/Querying Issue
Date Tue, 23 Jul 2019 17:49:45 GMT
We’re trying to index a polygon into solr and then filter/calculate geodist on the polygon
(ideally we actually want a circle, but it looks like that’s not really supported officially
by wkt/geojson and instead you have to switch format=”legacy” which seems like something
that might be removed in the future so don’t want to rely on it).

Here’s the info from schema:
<field name="latlng" type="location_rpt" indexed="true" stored="true" multiValued="true"/>

<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
                   geo="true" distErrPct="0.025" maxDistErr="0.000009" distanceUnits="kilometers"
                    spatialContextFactory="Geo3D"/>


We’ve tried indexing some different data, but to keep it as simple as possible we started
with a triangle (will eventually add more points to approximate a circle).  Here’s an example
document that we’ve added just for testing:

{
"latlng": ["POLYGON((33.7942704 -84.4412613, 33.7100611 -84.4028091, 33.7802888 -84.3279648,
33.7942704 -84.4412613))"],
"ID": "284598223"
}


However, it seems like filtering/distance calculations aren’t working (at least not the
way we are used to doing it for points).  Here’s an example query where the pt is several
hundred kilometers away from the polygon, yet the document still returns.  Also, it seems
that regardless of origin point or polygon location the calculated geodist is always 20015.115

Example query:
select?d=1&fl=ID,latlng,geodist()&fq=%7B!geofilt%7D&indent=on&pt=33.9798087,-94.3286133&q=*:*&sfield=latlng&wt=json

Example documents coming back anyway:
"docs": [
{
"latlng": ["POLYGON((33.7942704 -84.4412613, 33.7100611 -84.4028091, 33.7802888 -84.3279648,
33.7942704 -84.4412613))"],
"ID": "284598223",
"geodist()": 20015.115
},
{
"latlng": ["POLYGON((33.7942704 -84.4412613, 33.7100611 -84.4028091, 33.7802888 -84.3279648,
33.7942704 -84.4412613))"],
"ID": "284600596",
"geodist()": 20015.115
}
]


Anyone who has experience in this area can you point us in the right direction about what
we’re doing incorrectly with either how we are indexing the data and/or how we are querying
against the polygons.

Thank you,


--
Marshall Sanders
Principal Software Engineer
Autotrader.com
marshall.sanders2@coxautoinc.com<mailto:marshall.sanders2@coxautoinc.com>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message