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

Efficient highlighting


In certain situations, the standard highlighting mechanism might not be performing as you would like it to be. For example, you might have long text fields and want the highlighting mechanism to work with them. In such cases, there is a need of another, more efficient highlighter. Thankfully, there is a highlighter that is very efficient, and this recipe will show you how to use it.

How to do it...

  1. We begin with the index structure configuration, which looks as follows (just add the following section to your schema.xml file):

    <field name="id" type="string" indexed="true" stored="true" required="true" />
    <field name="name" type="text_general" indexed="true" stored="true"  termVectors="true" termPositions="true" termOffsets="true" />
  2. The next step is to index the data. We will use the following test data for the purpose of this recipe:

    <add>
     <doc>
      <field name="id">1</field>
      <field name="name">Solr Cookbook first edition</field...