lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Lancaster <>
Subject Geofilt and distance measurement problems using SpatialRecursivePrefixTreeFieldType field type
Date Thu, 13 Dec 2018 11:38:07 GMT
I am currently using Solr 5.5.2 and implementing a GeoSpatial search that returns results within
a radius in Km of a specified LatLon. Using a field of type solr.LatLonType and a geofilt
query this gives good results but is much slower than our regular queries. Using a bbox query
is faster but of course less accurate.

I then attempted to use a field of type solr.SpatialRecursivePrefixTreeFieldType to check
performance and because I want to be able to do searches within a polygon eventually. The
field is defined as follows

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

<dynamicField name="*__location_rpt" type="location_rpt" indexed="true" stored="true" multiValued="false"
omitNorms="true" />

I'm just using it to index single points right now. The problem is that the distance calculation
is not working correctly. It seems to overstate the distances for differences in longitude.

For example a query for &fl=Id,LatLonRPT__location_rpt,_dist_:geodist()&sfield=LatLonRPT__location_rpt&pt=53.409490
-2.979677&query={!geofilt sfield=LatLonRPT__location_rpt pt="53.409490 -2.979677" d=25}

                "Id": "HAR/CH1/80763270",
                "LatLonRPT__location_rpt": "53.2 -2.916666",
                "_dist_": 24.295607
                "Id": "HAR/CH42/1918283949",
                "LatLonRPT__location_rpt": "53.393239 -3.028859",
                "_dist_": 5.7587695

The true distances for these results are 23.67 and 3.73 km and other results at a true distance
of 17 km aren't returned within the 25 km radius.

The explain has the following
d=0.2° 25.00km),detailLevel=6,prefixGridScanLevel=7))

Is my set up incorrect in some way or is the SpatialRecursivePrefixTreeFieldType not suitable
for doing radius searches on points in this way?

Thanks in anticipation for any suggestions.

Peter Lancaster.

This message is confidential and may contain privileged information. You should not disclose
its contents to any other person. If you are not the intended recipient, please notify the
sender named above immediately. It is expressly declared that this e-mail does not constitute
nor form part of a contract or unilateral obligation. Opinions, conclusions and other information
in this message that do not relate to the official business of findmypast shall be understood
as neither given nor endorsed by it.


This email has been checked for virus and other malicious content prior to leaving our network.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message