Thanks Emir, Obviously #2 approach is much better. I know its not straight forward. But, is it really acheivable in Solr? Like building a polygon for a postal code. If so, can you throw some light how to do?
Thanks, Manohar On Friday, March 4, 2016, Emir Arnautovic <emir.arnauto...@sematext.com> wrote: > Hi Manohar, > This depends on your requirements/usecase. If postal code is interpreted > as point than it is expected to have radius that is significantly larger > than postal code diameter. In such case you can go with first approach. In > order to avoid missing results from postal code in case of small search > radius and large postal code, you can reverse geocode records and store > postal code with each document. > If you need to handle distance from postal code precisely - distance from > its border, you have to get postal code polygon, expand it by search > distance and use resulting polygon to find matches. > > HTH, > Emir > > On 04.03.2016 13:09, Manohar Sripada wrote: > >> Here's my requirement - User enters postal code and provides the radius. >> I >> need to find the records with in the radius from the provided postal code. >> >> There are few ways I thought through after going through the "Spatial >> Search" Solr wiki >> >> 1. As Latitude and Longitude positions are required for spatial search. >> Get >> Latitude Longitude position (may be using GeoCoding API) of a postal code >> and use "LatLonType" field type and query accordingly. As the GeoCoding >> API >> returns one point and if the postal code area is too big, then I may end >> up >> not getting any results (apart from the records from the same postal code) >> if the radius provided is small. >> >> 2. Get the latitude longitude points of the postal code which forms a >> border (not sure yet on how to get) and build a polygon (using RPT). While >> querying use this polygon and provide the distance. Can this be achieved? >> Or Am I ruminating too much? :( >> >> Appreciate any help on this. >> >> Thanks >> >> > -- > Monitoring * Alerting * Anomaly Detection * Centralized Log Management > Solr & Elasticsearch Support * http://sematext.com/ > >