Merge pull request #116 from DataShades/spatial-field-solr-5

#114 solr-spatial-field search Solr 5 compatibility
This commit is contained in:
Adrià Mercader 2016-05-31 15:22:58 +01:00
commit cb9c1294f2
2 changed files with 5 additions and 4 deletions

View File

@ -314,12 +314,12 @@ class SpatialQuery(p.SingletonPlugin):
'''
This will add an fq filter with the form:
+spatial_geom:"Intersects({minx} {miny} {maxx} {maxy})
+spatial_geom:"Intersects(ENVELOPE({minx}, {miny}, {maxx}, {maxy}))
'''
search_params['fq_list'] = search_params.get('fq_list', [])
search_params['fq_list'].append('+spatial_geom:"Intersects({minx} {miny} {maxx} {maxy})"'
.format(minx=bbox['minx'],miny=bbox['miny'],maxx=bbox['maxx'],maxy=bbox['maxy']))
search_params['fq_list'].append('+spatial_geom:"Intersects(ENVELOPE({minx}, {maxx}, {maxy}, {miny}))"'
.format(minx=bbox['minx'], miny=bbox['miny'], maxx=bbox['maxx'], maxy=bbox['maxy']))
return search_params

View File

@ -131,9 +131,10 @@ details about the available options:
<!-- ... -->
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
autoIndex="true"
distErrPct="0.025"
maxDistErr="0.000009"
units="degrees" />
distanceUnits="degrees" />
</types>
<fields>
<!-- ... -->