Geo Spatial Search Engine

Wow that's a mouth full, but that's what we've got. Well sort of, I've shown a few folks an extension
Local Solr to include Local Lucene. A weekends worth of work, simple and a quick hack.

Well it's now popular, and again with very little promotion, inside my company, there are currently 2 projects
that are going to get built against it. One of them is pretty big and a household name. Details later ;-)

On top of that, somebody out there, was looking for geospatial solution, found local lucene, just as about 5,000 people have. Looked at my cvs tree, and noticed I had Local Solr in there. So he downloaded it, tried
it and had compile issues, due to using a different version of solr.

After a couple of email's I got the guy going, and created a desktop distribution of local solr to make it easier.
Have a play with this if you want:
unzip it, or untar if your a geek like the rest of us. You need java to run this (no help there, sorry life is short)


I've included a list of new york cinemas for sample data, it's cost me $30 to get that data, so please be nice with your comments :-D

Go to solr-example/apache-solr-1.*/example and run "java -jar start.jar"
All of a sudden you will have a search engine running on your computer, woo hoo. Ohh big red apples.
Now point your browser to http://localhost:8983/localcinema/ (using firefox only, sorry again it's a quick demo) and click "go". Now either drag your map, or specify a more specific NY address or cinema.

If you like and you want to use, I'd appreciate a note letting me know, and recommend you check out Solr.

*Thanks to Andrei for providing me with some corrections*


  1. Andrei says:

    Hey, thanks so much for posting Local Solr example here - this is so cool! The test URL is http://localhost:8983/local..., not "localcinemas".
    I have noticed your example is built on Solr 1.1 Have you tested it with Solr 1.2 as well?
    Thanks again

    pjaol says:

    Hi Andrei, thank you for visiting an correcting me, the answer is I've updated it to the head of solr so 1.3.

    The CVS repository is ant based and contains all the necessary components for build it. Obviously supply your own ant.

    There are a few fixes in there currently, and if you using localsolr, please download the latest version.

    Oleg Gnatovskiy says:

    Hey, pjaol! Thanks for posting this! I just checked it out, and I'd like to see how int integrates with the chain collapse project going on with Solr. Since the 1.3 Head is constantly changing, I can't replace the solr jar file included with your local solr, since that causes errors. I was wondering if you still have your 1.1 version that I could take a look at?

    Daniel Andersson says:

    Hi Patrick

    I've been playing around with Local Solr and it's working well :)

    Have run into a few problems (and been unable to find your email address, so hijacking the comments here), which I'm hoping you can help me with.

    1. How do I sort by distance?
    2. When I specify a radius > 100, it fails with a null pointer. Is this something I can change? (I looked through the configs, found nothing) Or is it hardcoded?
    3. The distances-information in the response doesn't contain distances for all the documents that are returned. I'm guessing the ID/key sent in combination with a distance is the unique key specified in schema.xml?

    Thanks for your work on Local Solr, much appreciated!

    Kind regards,

    pjaol says:

    Hey Daniel

    Glad you found localsolr, You might have an old version of the software, the latest code is available from
    source forge,

    The subversion repository has the latest version, click on code > svn, for details on checking out the trunk.

    The parameters might have changed from the version you have, there is no need for the wt=geoX parameter anymore.

    To answer your questions,

    1) in the solr/conf/solrconfig.xml, there is a config value _startTier, which for radii over
    100 miles, you should set to something like 5. (you'll need to reindex your data)
    I'm in the process of writing documentation which details what tiers are.

    2) To sort by distance, simply add the parameter "sort=geo_distance asc"

    Hope that helps, also check out the mail lists on source forge, there is a locallucene-users, and locallucene-developer
    which will keep you upto date with latest developments in the project.


    rhodri says:

    Hi, great work on LocalSolr, it really is a useful addon. I've been using Solr 1.3-dev and LocalSolr r1.5 and it works really well, however I'm having difficulties using facet on the geo_distance field. I guess because it's not indexed - is there a way around this?

    Kurt Jarchow says:

    Do you know if localsolr will work on nightly builds of 1.4 solr? I've had this going on 1.3 but when I upgraded it is giving me a SEVERE: java.lang.NoSuchFieldError when I try to index content.

    Mike O-Connor says:

    kurt: I've been having the same problem. I don't recall where, but I remember an seeing an issue involving that error in Jira

    jig says:

    LocalSolr works well from the example. However, I can't find a way to add weighted query-field ratios the same way dismax handler does it. Infact, it seems like "qf" parameter does nothing. Any help would be appreciated.

    ssn says:

    Great library, Kudos!!. Queries like the one in example works perfectly fine for me too. But I am having difficulty in applying filters in a query. "fq" parameterts are ignored when the geo SearchHandler (qt=geo) is used. I did a little digging and found fq params are considered in LocalSolrQueryComponent process method. So is this a bug or am I missing something in the query? Thanks

    Adam says:

    This this looks very interesting, thank you for the blog / examples.

    I am trying to get this working with the Drupal solr module ( but am having issues with the 'java.lang.NoSuchFieldError ' error when submitting a document as previously mentioned, Drupal are using Solr 1.4 .

    Have you any tips on how to go about fixing this or any ideas if a fix is in process?

    TomW says:

    This works great - but I've noticed that the first geocode query after any update to the index is very slow. Is there any solution to this?

    soorej says:

    Does local solr works with Solr 1.4?

    Dan says:

    I have also noticed Filter Queries are ignored (fq param). Other than that and the fact that boosts also don't seem to work I think Local Lucene is great.

    R. Goodwin says:

    We're running into the same issues as listed here - sorting on geo_distance is generating an error "java.lang.AbstractMethodError" and using function queries appear to do nothing w/ the geo_distance field.

    Sandeep says:

    Hi All,
    LocalSolr geo_distance sorting is returning inconsistent results. It works fine sometimes and doesn't work sometimes. Is anyone facing the same issue? Any thoughts on this? Thanks in advance.


    Sandeep Tagore says:

    For NoSuchFieldError Exceptions:
    comment the log statement @ 138 line in file (localsolr)
    [//log.fine("Adding lat/lngs: "+ lat +", "+lng);]
    It works..
    - Sandeep Tagore, Mumbai

    Sandeep says:

    I get a java.lang.NullPointerException at when i use sort=geo_distance+asc parameter. Can you help me with this?


    SEVERE: java.lang.NullPointerException
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(

    Sandeep says:

    Added <cache name="distanceCache" class="" size="4096" initialSize="2048" autowarmCount="0"/> in solrconfig.xml but distanceCache hits are not getting displayed in admin/stats.jsp page. Can you help me with this?

    LoRdxx says:

    Dear Patric,

    We are playing with your localsolr-cinema code. It is gwt hard coded javascript so couldnt dig more. How we can download the source code or the local solr examples ? Can you help me.?



    DougN says:

    Now all you need is the ability to index footprints, even as rectangles that bound resources of interest. Parks, counties, parcels, and cities all have geometric (lat-long) extents that could be associated with their names (in a gazetteer). There are now millions of data sets that are described in XML files that contain these bounding boxes. A lucene handler that could recognize bounding boxes would be an excellent complement to the point-location capability.

Add Comment

This item is closed, it's not possible to add new comments to it or to vote on it

Comments must be approved before being published. Thank you!