You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Spadez <ja...@hotmail.com> on 2012/08/13 12:32:50 UTC

Custom Geocoder with Solr and Autosuggest

Hi,

I want to create a very simple geocoder for returning co-ordinates of a
place if a user enters in a town or city. There seems to be very little
information about doing it the way I suggest, so I hope I am on a good path.

My first decision was to divide SOLR into two cores, since I am already
using SOLR as my search server. One core would be for the main search of the
site and one for the geocoding.

My second decision is to store the name data in a normalised state, some
examples are shown below:
London, England
England
Swindon, Wiltshire, England

The third decision was to return “autosuggest” results, for example when the
user types “Lond” I would like to suggest “London, England”. For this to
work I think it makes sense to return up to 5 results via JSON based on
relevancy and have these displayed under the search box.

My fourth decision is that when the user actually hits the “search” button
on the location field, SOLR is again queries and returns the most relevant
result, including the co-ordinates which are stored.

Am I on a good path here? 




--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-Geocoder-with-Solr-and-Autosuggest-tp4000791.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Custom Geocoder with Solr and Autosuggest

Posted by Alexey Serba <as...@gmail.com>.
> My first decision was to divide SOLR into two cores, since I am already
> using SOLR as my search server. One core would be for the main search of the
> site and one for the geocoding.
Correct. And you can even use that location index/collection for
locations extraction for a non structural documents - i.e. if you
don't have separate field with geographical names in your corpus (or
location data is just not good enough compared to what can be mined
from documents)

> My second decision is to store the name data in a normalised state, some
> examples are shown below:
> London, England
> England
> Swindon, Wiltshire, England
Yes, you can add postcode/outcodes there also. And I would add
additional field "type" region/county/town/postcode/outcode.

> The third decision was to return “autosuggest” results, for example when the
> user types “Lond” I would like to suggest “London, England”. For this to
> work I think it makes sense to return up to 5 results via JSON based on
> relevancy and have these displayed under the search box.
Yeah, you might want to boost cities more than towns (I'm sure there
are plenty ambiguous terms), use some kind of geoip service,
additional scoring factors.

> My fourth decision is that when the user actually hits the “search” button
> on the location field, SOLR is again queries and returns the most relevant
> result, including the co-ordinates which are stored.
You can also have special logic to decide if you want to use spatial
search or just simple textual match would be better. I.e. you have
"England" in your example. It doesn't sound practical to return
coordinates and use spatial search for this use case, right?

HTH,
Alexey

Re: Custom Geocoder with Solr and Autosuggest

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Don't re-invent any wheels:
http://www.gisgraphy.com

I discovered Grisgraphy the other day which looks pretty awesome.  I haven't
used it.



-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-Geocoder-with-Solr-and-Autosuggest-tp4000791p4001446.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Custom Geocoder with Solr and Autosuggest

Posted by Spadez <ja...@hotmail.com>.
Cheeky bump



--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-Geocoder-with-Solr-and-Autosuggest-tp4000791p4001424.html
Sent from the Solr - User mailing list archive at Nabble.com.