Avoid the impact of search errors during index creation

Source: Internet
Author: User

The Lucene index file on the company's website is automatically generated every day. Of course, this is also because of the need. This morning, we found a problem: an index error occurred during the generation process, the direct consequence is that the search content is almost empty!
So how can we avoid a similar problem? I used to set the index file location and the index file location during search to two directories.
For example, when an index is generated: The index is generated to the index_bak directory.
Use the index file under the index directory during search
ProgramThe running process is as follows:
1. Determine whether index_bak exists. Otherwise, create
2. generate an index file in the index_bak directory. If any error occurs, return false and record the log.
3. If there is no error, delete the original index under the index directory.
4. Change the index_bak name to index.

This is the above method. If you have a better solution, please let us know.

Related Article

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.