Book Image

Apache Solr Beginner's Guide

By : Alfredo Serafini
Book Image

Apache Solr Beginner's Guide

By: Alfredo Serafini

Overview of this book

<p>With over 40 billion web pages, the importance of optimizing a search engine's performance is essential.<br /><br />Solr is an open source enterprise search platform from the Apache Lucene project. Full-text search, faceted search, hit highlighting, dynamic clustering, database integration, and rich document handling are just some of its many features. Solr is highly scalable thanks to its distributed search and index replication.<br /><br />Solr is written in Java and runs as a standalone full-text search server within a servlet container such as Apache Tomcat or Jetty. Solr uses the Lucene Java search library at its core for full-text indexing and search, and has REST-like HTTP/XML and JSON APIs that make it usable with most popular programming languages. Solr's powerful external configuration allows it to be tailored to many types of application without Java coding, and it has a plugin architecture to support more advanced customization.<br /><br />With Apache Solr Beginner's Guide you will learn how to configure your own search engine experience. Using real data as an example, you will have the chance to start writing step-by-step, simple, real-world configurations and understand when and where to adopt this technology.<br /><br />Apache Solr Beginner's Guide will start by letting you explore a simple search over real data. You will then go through a step-by-step description that gives you the chance to explore several practical features. At the end of the book you will see how Solr is used in different real-world contexts.<br /><br />Using data from public domains like DBpedia, you will define several different configurations, exploring some of the most interesting Solr features, such as faceted search and navigation, auto-suggestion, and rich document indexing. You will see how to configure different analysers for handling different data types, without programming.<br /><br />You will learn the basics of Solr, focusing on real-world examples and practical configurations.</p>
Table of Contents (19 chapters)
Apache Solr Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – playing with range queries


Another good option for queries is the possibility to play over a certain range of data. This is particularly useful when dealing with numeric values (the trie types are designed to perform well in this case) and date/timestamp values too.

Just to give you an idea, we could test the following simple queries:

>> curl -X GET 'http://localhost:8983/solr/paintings_readonly/select?q=width:[5 TO 8]&fl=title'
>> curl -X GET 'http://localhost:8983/solr/paintings_readonly/select?q=timestamp:[* TO NOW]'
>> curl -X GET 'http://localhost:8983/solr/paintings_readonly/select?q=timestamp:[NOW-20MINUTES TO NOW}'

What just happened?

The first case is really intuitive. In it, we search for documents with width values from five to eight.

For dates, on the other hand, things generally get a bit more complicated. Solr uses the default canonical representation for date types as given in the following link:

http://www.w3.org/TR/xmlschema-2/#dateTime...