Solrsolr related operations (addDocument, flush, commit, rollback, optimize, close) analysis

Some of the following operations are usually included in solr, including explicit and implicit operations

1. addDocument, which analyzes the document, performs word segmentation, and creates an index segment segment. Whenever a document is added to the flush buffer, the index file will create a new segment segment.

2. commit, in addition to submitting index changes to the Directory object, the re-establishment of the searcher query

After the commit is submitted, the index is flushed to the hard disk, and the listener is triggered to create a new insexSearcher (a new insexReader, which loads the index from the hard disk), so that subsequent queries use the new insexsearcher.

After solr4.0, there are two kinds of commits, one is hard commit and the other is softcommit;

When hardcommit, the document needs to be flushed to the storage, and the new searcher will be warmed; while softcommit is proposed in the NRT real-time search, it will not flush to the persistent storage, and the document can be searched at a lower cost than hardcommit There are many; in scenarios with high real-time requirements, softcommit operations can be performed, but hardcommits are still required to ensure that the index is persisted to storage.

 

3, rollback, rollback changes to the index of the document

4. Flush, when the size of the index of the document in memory is greater than a certain threshold, it will be flushed to the hard disk

If the following two conditions are met, the cache is automatically flushed to the storage; however, the index that has been added but not submitted cannot be searched at this time.
    <ramBufferSizeMB>100</ramBufferSizeMB>

     <maxBufferedDocs>1000</maxBufferedDocs>

     After Solr 4.0, the concept of transaction log updatelog is enabled, which can ensure that no data is lost; after a shutdown, recovery can be performed according to updatelog, automatic index creation, and timely index flushing to disk in the future.
5. close, the close operation of IndexWrite in lucene implicitly performs the flush operation, and then performs the commit operation

6、optimize(merge),

Kind of like defragmenting a hard drive. In order to improve the search speed, it will reorganize the index together, and then remove the documents that need to be deleted or updated. Please note that there is no such operation in solr, only addition and deletion. When Solr optimizes, it marks the index that needs to be deleted or replaced as deleted, and then creates a new document to replace the index that needs to be replaced. optimize does just that. So when optimizing, your index will grow and then decrease. The optimize operation will create a brand new index structure, so you need to reserve 2 times the size of the index when you commit.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326588195&siteId=291194637