Solr4.8.0 Source Code Analysis (13) of the lucenecore of the index repair

Source: Internet
Author: User

Solr4.8.0 Source Code Analysis (13) of the lucenecore of the index repair

Preface: Today in the company research Elasticsearch, suddenly saw a blog said elasticsearch with index repair function, a sense of curiosity, so point into the next, found that the original is Lucene core features, So I went home to learn, just as well as the previous look at the format of the index file corresponding. Also study some of Lucene's gadgets when you are free.

The main purpose of the index repair is to use the Checkindex.java class, you can directly see the class's main function to understand the next.

1. Use of CheckIndex

First use the following command to see how Lucenecore.jar is used:

1 192: Lib rcf$ Java-CPlucene-core-4.8-snapshot.jar-ea:org.apache.lucene ... org.apache.lucene.index.CheckIndex2 3 error:index Path not specified4 5Usage:java org.apache.lucene.index.CheckIndex Pathtoindex [-fix] [-crosschecktermvectors] [-segment X] [-segment Y] [-dir-Impl X]6 7-fix:actuallyWriteA new Segments_nfile, removing any problematic segments8-crosschecktermvectors:verifies that term vectors match postings; This is VERY slow!9-codec X:when fixing, codec toWriteThe new Segments_nfile withTen-Verbose:print Additional Details One-segment X:only Check the specified segments. This can is specified multiple ATimes, to check Morethan one segment, eg'-segment _2-segment _a'. -You can'T use this with the-fix option --dir-Impl X:use a specific fsdirectory implementation. If No is specified , the Org.apache.lucene.store package would be used. the  -**warning**:-fix should only is used on a emergency basis as it would cause -Documents (perhaps many) to being permanently removed from the index. Always Make -A backup copy of your index before running this!Does not run the This tool is on an index +That's actively being written to. You have been warned! -  +Run without-fix, this tool would open the index, report version information Aand report any exceptions it hits and what action it would takeif-Fix were atSpecified. With-fix, this tool would remove any segments that has issues and - WriteA new Segments_nfile. This means all documents containedinchThe affected - segments'll be removed. -  -This tool exits with exit code1 ifThe index cannot be opened or have any -Corruption,Else 0.

When knocking Java-cp lucene-core-4.8-snapshot.jar-ea:org.apache.lucene ... org.apache.lucene.index.CheckIndex This will see the equivalent of help information, but why is there such a strange sequence of commands?

It's too late today to continue studying tomorrow.

Solr4.8.0 Source Code Analysis (13) of the lucenecore of the index repair

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.