Tropical Software Observations

27 July 2010

Posted by Unknown

at 2:05 PM


Labels: , ,

Spatial Search with Grails and Solr Plugin

Grails has a good Solr plugin ( that works well and also provides spatial search that works out of the box. However, the documentation to use this feature is a bit skimpy so here are the basic steps to enable spatial search with Solr for your Grails app.

Install the solr plugin for Grails using 'grails install-plugin solr' and enable Solr indexing for your domain class by:

    static enableSolrSearch = true
    static solrAutoIndex = true

Next, we need to add a Solr index field annotation to the domain members.

    //import org.grails.solr.Solr
    Double latitude

    Double longitude

Once we have those in place, we can use SolrService to query:

    getSpatialQuery(query, lat, lng, range)


AM said...

thank you. I was hunting for this.

Fran GarcĂ­a said...

Does anybody know if it is possible to have two different datasources being one of them solr?

for ict 99 said...

Great Article
Final Year Project Domains for CSE
Project Centers in Chennai

JavaScript Training in Chennai
JavaScript Training in Chennai