Hi Gus, Thank you for your reply. I am trying to emulate an existing API that is why I am trying to work with the Zipcode directly. After looking at this it looks like I will have to do a few things.
1. When indexing I will need to index the location in a spatial field <fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/> 2. Along with the zipcode (in case just a straight zipcode match is desired) I will have to lookup the GPS coordinates of the zipcode and pass them as the pt parameter. 3. Finally, I will need to use the functional query geodist() to return a field that will be the distance from the location in item 1 and the pt parameters in item 2. Does this sound about right? Thanks ________________________________ From: Gus Heck <gus.h...@gmail.com> Sent: Wednesday, December 14, 2022 7:28 AM To: users@solr.apache.org <users@solr.apache.org> Subject: Re: spatial search by zipcode Hi Matthew, It's worth keeping in mind that if you are *starting* with user input that has a zip code ("where zipcode is provided as a parameter?"), then it's faster at query time if you index the documents with a zip code and just match zip ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside the St. Luke's email system. ZjQcmQRYFpfptBannerEnd Hi Matthew, It's worth keeping in mind that if you are *starting* with user input that has a zip code ("where zipcode is provided as a parameter?"), then it's faster at query time if you index the documents with a zip code and just match zip codes. If your documents have GPS points but not zipcodes or only some have the zip code, calculate the zip code (when required) during indexing and add it to the document. Do the work during indexing whenever possible. Geo queries would tend to come into play if you were starting with a GPS point and wanted documents within a radius, or within a polygon defined by the user, etc. One could do radius from a centroid of a zip or something like that, but that's pretty coarse, and unless the distances are tens of miles or more, distances from an address (located to a GPS point via a service) would often be more valuable to the user since zip codes can be quite large in rural areas, and sometimes have funny shapes. Best, Gus On Tue, Dec 13, 2022 at 3:00 PM Markus Jelsma <markus.jel...@openindex.io> wrote: > Hello, > > Here's information on how to filter based on geographical distance: > https://urldefense.com/v3/__https://solr.apache.org/guide/solr/latest/query-guide/spatial-search.html__;!!FkC3_z_N!OWjWi46LjoV7yrASnPQPV4l8VKNjbtPJLv8PZyxFqtjhv6fkpNLf-8XJpiKU2_obKepeo0vHi6uy7w$ > > Regards, > Markus > > Op di 13 dec. 2022 om 20:34 schreef Matthew Castrigno <castr...@slhs.org>: > > > Thank you Dmitri. > > > > I am thinking I can use this information with the geodist() function > query > > but strangely enough the geodist() function is not listed in the > > documentation on the Function queries page. > > > https://urldefense.com/v3/__https://solr.apache.org/guide/solr/latest/query-guide/function-queries.html__;!!FkC3_z_N!OWjWi46LjoV7yrASnPQPV4l8VKNjbtPJLv8PZyxFqtjhv6fkpNLf-8XJpiKU2_obKepeo0uSqUjkqw$ > > > > Where can I find more information about it? > > ________________________________ > > From: dmitri maziuk <dmitri.maz...@gmail.com> > > Sent: Tuesday, December 13, 2022 12:27 PM > > To: users@solr.apache.org <users@solr.apache.org> > > Subject: Re: spatial search by zipcode > > > > On 2022-12-13 12: 31 PM, Matthew Castrigno wrote: > Is there an > > established method to do spatial search by zipcode where zipcode is > > provided as a parameter? https: //urldefense. com/v3/__https: //www. > > unitedstateszipcodes. > > > org/zip-code-database/coordinates/__;!!FkC3_z_N!ItGJDCHlhXKPV8xNFsxLmleneNLak-CNyQneTT55tYQ9JE5lyl87FQIWSYrckHUfnDRi60owMdd5iWZVm-a-$ > > ZjQcmQRYFpfptBannerStart > > This Message Is From an External Sender > > This message came from outside the St. Luke's email system. > > > > ZjQcmQRYFpfptBannerEnd > > > > On 2022-12-13 12:31 PM, Matthew Castrigno wrote: > > > Is there an established method to do spatial search by zipcode where > > zipcode is provided as a parameter? > > > > > > > https://urldefense.com/v3/__https://www.unitedstateszipcodes.org/zip-code-database/coordinates/__;!!FkC3_z_N!ItGJDCHlhXKPV8xNFsxLmleneNLak-CNyQneTT55tYQ9JE5lyl87FQIWSYrckHUfnDRi60owMdd5iWZVm-a-$ >> > > (Because I very recently looked at spatial searches in our index and > > this is still in my browser history) > > > > Dima > > > > > > > > ---------------------------------------------------------------------- > > "This message is intended for the use of the person or entity to which it > > is addressed and may contain information that is confidential or > > privileged, the disclosure of which is governed by applicable law. If the > > reader of this message is not the intended recipient, you are hereby > > notified that any dissemination, distribution, or copying of this > > information is strictly prohibited. If you have received this message by > > error, please notify us immediately and destroy the related message." > > > -- https://urldefense.com/v3/__http://www.needhamsoftware.com__;!!FkC3_z_N!OWjWi46LjoV7yrASnPQPV4l8VKNjbtPJLv8PZyxFqtjhv6fkpNLf-8XJpiKU2_obKepeo0sU1e0HrA$ (work) https://urldefense.com/v3/__http://www.the111shift.com__;!!FkC3_z_N!OWjWi46LjoV7yrASnPQPV4l8VKNjbtPJLv8PZyxFqtjhv6fkpNLf-8XJpiKU2_obKepeo0t_jIORmQ$ (play) ---------------------------------------------------------------------- "This message is intended for the use of the person or entity to which it is addressed and may contain information that is confidential or privileged, the disclosure of which is governed by applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this information is strictly prohibited. If you have received this message by error, please notify us immediately and destroy the related message."