Book Image

Solr Cookbook - Third Edition

By : Rafal Kuc
Book Image

Solr Cookbook - Third Edition

By: Rafal Kuc

Overview of this book

Table of Contents (18 chapters)
Solr Cookbook Third Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Optimizing the primary key indexation


Most of the data stored in Solr has some kind of primary key. Primary keys are different from most of the fields in your data as each document has a unique value stored because they are primary, and in most cases, unique. However, this search on the primary field is not always as fast as you would expect when you compare to other databases. So, is there anything we can do to make it faster? With Solr 4.0, we can, and this recipe will show you how to improve the execution time of queries run against unique fields in Solr.

Note

Keep in mind that the method shown in this recipe is very case dependent, and you might not see a great performance increase with the mentioned change. What's more, if you are using the newest version of Solr/Lucene, the pulsing codec is already a part of the default Lucene posting format.

How to do it...

  1. Let's assume we have the following field defined as the unique key for our Solr collection. So, in your schema.xml file, you will...