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 check index functionality


It's night; the phone is ringing, you answer it and hear: "We've got a problem—the index is corrupted, nothing works, the apocalypse is coming". What can we do? Is there anything besides the full indexation or restoring from backup? There is something that we can do and this recipe will show you.

How to do it...

For the purpose of this recipe, let's suppose that we have a corrupted index that we want to check and fix. To use the CheckIndex class that we will use, we will need to point it to the index we want to fix. We will need to run a command similar to the following one:

java –cp LUCENE_JAR_LOCATION -ea:org.apache.lucene... org.apache.lucene.index.CheckIndex INDEX_PATH -fix

Here, INDEX_PATH is the path to the index, for example, /usr/share/solr/data/index and LUCENE_JAR_LOCATION is the path to the Lucene core JAR library (which is provided with the Solr distribution). So, with the given index location, the command will look as follows:

java –cp lucene...