Hi,
I'm experimenting with solr spatial search, with plotting points in the map
(Latitude and longitude) and based on the value I need to get the result.
As the first step I've defined the filed type as
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
distErrPct="0.025" maxDistErr="0.000009" units="degrees" />
And then added the field *location* as type *location_rpt*
<field name="location" type="location_rpt" indexed="true" stored="true"
multiValued="true" />
Indexed the location filed as $latitude, $longitude So that data in the
*location* will be like
"location":["9.445890,76.540970"]
Next I draw a polygon in google map and collected the lat and lng
coordinates of the polygon.
It will be like
9.472992 76.540817, 9.441328 76.523651 , 9.433708 76.555065 , 9.458092
76.572403, 9.472992 76.540817
Based on this coordinates I performed a query in solr like this
localhost:8983/solr/ha_poc/select?fl=id,name,district,locality&wt=json&
json.nl=map&q=*:*&fq=location:"IsWithin(POLYGON((9.472992 76.540817,
9.441328 76.523651 , 9.433708 76.555065 , 9.458092 76.572403, 9.472992
76.540817))) distErrPct=0"
But I didn't get the result from the solr as I expected.
{
- "responseHeader": {
- "status": 0,
- "QTime": 2
},
- "response": {
- "numFound": 0,
- "start": 0,
- "docs": [ ]
}
}
Is there anything that I missed ???
Can anybody help me in solving this issue with solr spatial search.
I'm using Solr 4.4.0
Added an additional dependency JTS jar file for the support of polygon
/lib/ext/jts-1.13.jar
--
*dhanesh s.r*