• Products
    • Overview
    • LucidWorks Search Platform
      • Features and Benefits
      • Technical Overview
      • Only with LucidWorks
      • LucidWorks and Solr
      • White Papers
      • LucidWorks Enterprise
      • LucidWorks Cloud
      • LucidWorks Big Data
    • Apache Releases
      • Apache Solr 4.0-dev
      • Apache Lucene
  • Support & Services
    • Overview
    • Support
    • Lucid University
    • ExpertLink Advisory
    • Consulting
    • Partners
    • Subscriptions
  • Why Lucid?
    • Why Lucid?
    • Technology
    • Who uses Lucene/Solr?
      • What customers are saying
    • Case Studies
    • Whitepapers
    • Demos
    • Webinars
  • Blog
  • DevZone
    • DevZone Overview
    • Forums (LWE)
    • Videos & Podcasts
      • How To's
      • Screencasts
      • Podcasts
      • Conference Videos
    • Technical Articles
      • Whitepapers
    • Reference Materials
      • Documentation
      • Solr Reference Guide
      • Solr & LucidWorks Matrix
      • Tutorials
    • Events
      • Lucene Revolution
      • Tradeshows & Conferences
      • Meet Ups
    • Code & Test
  • Downloads
  • About Us
    • Management
    • Board of Directors
    • Apache Lucene/Solr Committers
    • Careers
    • News
      • Media Coverage
      • Press Releases
    • Contact Us
Sign Up or Log In
Home . DevZone . Reference Materials

Getting Started with Solr 1.4 Tutorial - Video Transcript

Watch the Solr 1.4 Tutorial Video
 

Getting Started with Solr 1.4 Tutorial - Video Transcript

Welcome to getting started with Apache Solr using the LucidWorks certified distribution of Solr. If you haven't already installed the certified distribution, please hit pause and visit LucidImagination.com for a free download.

Now that you've installed the certified distribution of Solr, we need to start it up. If you are on Windows, you can click on the desktop start icon, or on any platform, open a shell or terminal window and change to the LucidWorks directory, then change to the example directory, and type Java-jar start.jar.
 
Now that you've started Solr, in another shell change into the LucidWorks/Example/Exampledocs directory and run Java-jar post.jar start.xml. This will index several sample files so we'll have some data to work with.
 
Next, launch your web browser and go to local host, port 8983/Solr and open the admin interface, and browse to the statistics page and see how many documents were just indexed.
 
Now we're going to do some searches with Solr. Using the URL to interface with Solr, we go to the Solr/select URL. We'll add a q parameter, which gives the text to the query. We'll query for video. And we see the first page of results returned to us in xml format with a header that specifies the query time, the status of the query, and some parameters that are echoed back to us. 
 
We can also narrow down the fields that are returned for each document to a set specified by the client. In this case, we're going to use the FL parameters to request only the ID, the name, and the price be returned. By doing this, we can avoid large text fields coming back to the client if they aren't needed.
 
Solr also supports a sophisticated query syntax. In this example, we're going to narrow the query and only search within the name field for the word black. And to do this, we use a query of name:black. 
 
Solr also supports a number of other query types. In this case, we're going to do a range query on the price field for all documents that have a price between $0.00 and $400.00. So we'll issue that query and get the response back. 
 
Next up, we're going to turn on one of Solr's most interesting features, faceting. And when we turn on faceting, what we will see is the number of occurrences of each distinct value in the field we specified, in this case the cat field, which holds the item's category. 
 
So we are seeing the number of documents within the current result set in each one of these categories. So within the price range of $0.00 to $400.00, we have 12 electronic documents, for example. 
 
To filter results in Solr, we can also add FQ parameters. FQ stands for filter query. In this example, we're going to filter to documents with a category of electronics by adding FQ=cat:electronics. Leaving faceting on, we can see that we've narrowed down to documents with a category of electronics, and it gives us the counts for those documents. 
 
Then we can drill down further by restricting to those documents that also have a category of memory. So in this example, we've narrowed down to documents with category electronics and category memory all in one shot.
 
Now let's look at Solr's schema. Go back to the main admin page, at local host:8983/Solr/admin. From there, we can click on schema to see the contents of the schema.xml file, and to browse the various types that are defined in there. 
 
These are the user configurable types. Now we're going to look at the various fields that are defined in this example application. We have ID, SKU, name, category, price. All these have various field types that define whether a field is stored, indexed, multi-valued, and various other Lucene index-related attributes. 
 
In this case, you can see the price is a float type. And then on down in the schema, we also see dynamic fields, so that you can have various wild card naming patterns for the field types and the fields coming in from the documents. 
 
In addition to the schema, much of Solr's configuration is found in a file called Solrconfig.xml. In Solrconfig.xml, probably the most interesting part is the request handler configuration. Right here, we see the standard request handler. That's the /select that we've been using to make queries, and we see it's default parameters. Not much there, other than to echo the parameters.
 
A more sophisticated example in the Solr example application is the partitioned request handler. It's using the dismax query parser, and it's got a QF parameter, which defines the list of fields to be queried. It limits its results to in stock items only, and has also specified a hard-coded set of facets that will be returned for every request, when faceting is enabled.
 
Leveraging the partitioned request handler shown in the previous section, let's show how this is used. From the browser, let's go to QT=partition. That's selecting the partitioned request handler. We're going to search for iPod, and we're also adding the parameter to echo all parameters from Solr, so that we see the ones that are defined in the request handler as well as the ones provided by the browser.
 
Another feature we can turn on is faceting. As you saw in the example of the request handler, the faceting configuration was already fixed in Solrconfig.xml. All we have to do is say facet=on as a parameter to enable faceting, which gets us those facets already hard-coded in Solrconfig.xml.
 
And now we can also add a parameter of debug query=true to see more sophisticated output from Solr and examine how the queries are being parsed, as well as explanations for why documents score where they do. In addition, you also get timing information from each of the search components attached to the request handler being used. 
 
Now let's switch back to a terminal window. We're going to take a look at Solr's xml format. Browsing to one of the example documents, we see that it's a very simple xml format. It's literally just documents with fields. Fields has name and a textual value, and you can add multiple documents per request. 
 
Next is to show how to delete documents from Solr. You can post an xml document that will delete by ID or delete by query. In this example, we're showing deleting by ID. One of the example documents has an ID of Solr1000, so we'll delete that. 
 
Now we are going to delete by query. We're going to delete all documents which have a category of software. And we're using the stream.body request parameter here to be able to show it through the browser, but this is normally done through an http post. 
 
To make document adds or deletes visible to the search interface, we must first issue a commit. The commit process warns Solr caches and brings the updated index online. 
 
One final administrative option is optimize. Optimize squeezes deleted documents out of the index and merges Lucene segments, making searches as fast as possible. 
 
That's it for our tutorial. Thank you very much for watching. 
 
[End]

Case Study

Closing the Knowledge Gap: A Case Study - How Cisco Unlocks Communications
Solr Development Case Study: resolutionfinder.org

Whitepapers

Programmer's Guide: Using LucidWorks Enterprise to add Search to your Web Application
Getting Started With LucidWorks Enterprise

DevZone

Latest Blog Post

Lucene Revolution 2012: Presentation slides are...
Lucene Revolution 2012, held in Boston on May 7-10 was a huge success. The four-day conference began with two days of Lucene/Solr and Big Data training followed by two days of...
  • Tutorials
  • Blog
  • Whitepapers
  • Docs
  • Forums
  • Support
Share
Follow Facebook Twitter LinkedIn YouTube
RSS Feed
  • Contact Us
  • About Lucid Imagination
  • Help & Support
  • Training
  • Website Feedback
  • Privacy Policy
  • Legal Terms of Use
  • Copyrights and Disclaimers
  • Sitemap
  • Admin

Apache Solr, Solr, Apache Lucene, Lucene and their logos are trademarks of the Apache Software Foundation.

© 2012 Lucid Imagination. All Right reserved.