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

Using the enumeration type


Imagine that we use Solr to store information about our environment's state, error, and events related to them—a simple solution that will work as a simple log centralization solution. For our simple use case, we will store the identifier of the message, the information, what type of event it is, and the severity of the event, showing us how important the event is. However, what we will want to be sure of is that the severity field contains only values from a given list. To achieve all this, we will use the Solr enumeration type.

How to do it...

To achieve our requirements, we will have to perform the following steps:

  1. We will start with the index structure. Our field list from the schema.xml file will look as follows:

    <field name="id" type="string" indexed="true" stored="true" required="true" />
    <field name="problem" type="text_general" indexed="true" stored="true" />
    <field name="severity" type="enum_type" indexed="true" stored="true" />
  2. In addition...