Make delicious recipes!

Running Solr


Running a Solr instance is just as simple as these 3 steps:
  1. Download and extract Solr.
  2. Run java -jar start.jar from example directory.
    This launches Solr in Jetty web-server.
  3. Run http://localhost:8983/solr to see the Solr running.
Note: Jetty is a full-java-based webserver which has a very small memory footprint.
This ensures that the application instead of the server takes up the full machine memory when running.
It also has support for SPDY, WebSocket, OSGi, JMX, JNDI, JAAS etc.




Now that Solr is running, you can index some documents by running java -jar post.jar *.xml from exampledocs directory.
Then select collection1 from the left drop-down at http://localhost:8983/solr

From the above, various queries can be run whose syntax is as follows:
http://localhost:8983/solr/collection1/select?
  q=USB&                   (Main query which will get documents containing the word USB)
  fq=manu:Canon&           (Filter Query that filters obtained results, selecting those where manu is Canon)
  sort=price asc&          (Sorts by price in ascending order)
  fl=id,name,price,score&  (Specifies the fields to obtain from the query)
  wt=json&                 (Specified the format of results. XML/CSV can also be specified)
  indent=true&             (Flag to indent results or not)
  start=0&rows=10          (For pagination)

For a complete guide on the query syntax, see the lucene site





Like us on Facebook to remain in touch
with the latest in technology and tutorials!


Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Name:
Email: (Your email is not shared with anybody)
Comment:

Facebook comments:

Site Owner: Sachin Goyal