Book Image

Solr Cookbook - Third Edition - Third Edition

By : Rafal Kuc
Book Image

Solr Cookbook - Third Edition - Third Edition

By: Rafal Kuc

Overview of this book

This book is for intermediate Solr Developers who are willing to learn and implement Pro-level practices, techniques, and solutions. This edition will specifically appeal to developers who wish to quickly get to grips with the changes and new features of Apache Solr 5.
Table of Contents (18 chapters)
Solr Cookbook Third Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Using routing


Routing is the ability to point queries and index it to a single shard of the collection. Let's assume that we have a single collection and store data of hundreds of clients in that collection. We can have a single collection per customer, but there are just too many of them, so such a solution is not scalable at all. Instead we go with one collection and we keep the data of a single customer in a single shard, so when querying we don't have to query all the shards. This allows you to save resources when querying. This recipe will show you how to do it.

Getting ready

Before reading further, I advise you to read the Creating a new SolrCloud cluster recipe of this chapter. This recipe will show you how to create a new SolrCloud cluster and create a collection. We also assume that ZooKeeper is running on 192.168.1.10 and is listening on port 2181 and we already have four SolrCloud nodes running as a cluster.

How to do it...

  1. For the purpose of this recipe, we will use the following...