Using Local Solr

Beginner Level
Under the covers of the demo, there are several processes occurring.


Indexing

The demo already comes with data indexed, the raw data we're using in the demo is available in

solr-example/data/ny_cinemas.xml

Lets begin with removing solrs existing index, stop solr if it's running, then delete / rename

solr-example/apache-solr-1.3-dev/example/solr/data

Restart solr, by running java -jar start.jar again, verify that the index directory if empty by going
to solr's admin web page http://localhost:8983/solr/admin/, and clicking on [Statistics].

Uploading the data is as simple as running solr's post jar

java -jar solr-example/apache-solr-1.3-dev/example/exampledocs/post.jar
solr-example/data/ny_cinemas.xml

*Obviously on Windows, the '/' would be replaced with ''.

Querying
Querying localsolr is as simple as using 5 parameters

  • q, solr's query parameter
  • qt, query type, we specify 'geo' to activate local solr.
  • lat, latitude of the point you want to begin searching from.
  • long, longitude of the point you want to begin searching from.
  • radius, radius in miles from the point you want search from.

Resulting in:
http://localhost:8983/solr/select?q=*:*&qt=geo&long=-74.0093994140625&lat=40.75141843299745&radius=1

Questions?

There are often questions around this, some of which are answered in the F.A.Q or in the up coming pages.

  • One common question is, 'how do I get the latitude / longitude of an address?'
    • Hopefully this is addressed in the GeoCoding section.