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

Improving faceting performance for low cardinality fields


Although Solr faceting is very fast, there are times when the default configuration values are not as fast as they can be. There are a few cases where we can tune Solr faceting mechanism and make it work faster. This recipe will show you how to tune the faceting mechanism.

Getting ready

Before you start reading this recipe, take a look at the Getting the number of documents with the same field value recipe of this chapter.

How to do it...

For the purpose of this recipe, we will assume that we have the following index structure:

  1. Add the following section to your schema.xml file:

    <field name="id" type="string" indexed="true" stored="true" required="true" />
    <field name="tag" type="string" indexed="true" stored="true" />
  2. We've used the following bash script to index the data (note that we are indexing two million documents here and are sending them one by one. So it might take a long time to index the data):

    #!/bin/sh
    URL=http:/...