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 ...

Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.