The task at hand

In the previous lesson you learned that a full-text index is required to enable full-text search. A full-text index is only created once and should be updated regularly.

In reality, a full-text index includes two indexes: main and supplementary. When a full-text search is performed, both indexes are searched. The difference is as follows.

The main index is designed to ensure maximum search speed with large data volume. But the disadvantage is that data is added to the main index quite slowly.

The supplementary index is a direct opposite of the main index: data is added to the supplementary index fast but if the data volume in the supplementary index is significant, the search is performed relatively slowly.

The availability of the main and supplementary indexes suggests the following usage strategy. The majority of data is located in the main index, which enables quite a rapid search. New data (either modified or added) is added to the supplementary index in real time with a required periodicity (for example, once per hour or every minute). Data is added rapidly and does not influence the system performance significantly. While the supplementary index does not contain a large volume of data, search in this index is also performed rapidly.

In the periods of low user activity or when scheduled infobase operations are performed (often in the night), the main index is merged with the supplementary index (this can be done once a day). This operation might generate noticeable load or take a long time (depending on the amount of data accumulated). As a result, new data is moved to the main index while the supplementary index is cleared and prepared for quick filling with new data.

To enable users to search in all the data without impacting the system performance, the supplementary index should be updated quite frequently (for example, once per hour or every minute). Besides, to keep the search rapid enough, the supplementary index should contain as little data as possible, hence the main index should be merged with the supplementary index regularly (for example, in the night during the minimum user activity period).

So to automate full-text indexing, you need two jobs. The first job will perform indexing without merging and will be executed every minute. The second job will merge indexes and will be executed once a day in the night.

Let us proceed to creating the jobs.

Next page: Understanding scheduled jobs

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.