Tips -- indexsearcher automatic update

Source: Internet
Author: User
Scenario Description

To improve efficiency, creating a global variable indexreader replaces the efficiency problem caused by creating an indexreader for each query.

At that time, the Index Service and search service deployed at index 8.23 on one side will be updated every day. The index is updated to 8.25, and the query result is still 8.23.

Tips sharing

Let's take a look at the indexsearcher construction method indexsearcher = new indexsearcher (indexreader );

When you pass in an indexreader, you must know that the reader will not be closed in other cases unless the reader is disabled manually.

So even if the index file changes, indexsearcher won't catch it or update it in time.

Therefore, the searcher service and the index service need to maintain the same update frequency. After the index is updated, the searcher reopens an indexreader.

Indexreader. Close (); indexreaded = new indexreader (directory); indexsearcher = new indexsearcher (indexreader );

 

Tips -- indexsearcher automatic update

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.