Synchronizing the Substring Indexes
The data in a substring index must be synchronized as changes are made to the source attribute. Operations that create a new object (insert), modify the attribute on an existing object (update), or delete an object (remove) require updates to the data in the substring index.
The following options are available for synchronizing substring indexes with their source attributes:
• Event-driven synchronization
• Scheduled background queue processing
• Manual synchronization
You can use different synchronization methods for a substring index. Each individual substring index and operation type (insert, update, or remove) can be configured separately for synchronization. For example, event processing could be used for insert and update operations, while background queue processing could be used for remove operations.
Event-Driven Synchronization
Event-driven synchronization can occur on insert, update, or remove events. When enabled, the source attribute is synchronized to the substring index in the same transaction as the original operation. Changes are immediately reflected in any query that uses a substring index. The disadvantage to this option is that extra processing time is added for the operation.
Event-driven synchronization is configured using the
synchronizeOnInsert,
synchronizeOnRemove, and
synchronizeOnUpdate properties in the
configuration file. This synchronization option is disabled by default.
Scheduled Background Queue Processing Synchronization
When synchronization is configured to use scheduled background queue processing, a scheduled queue periodically executes based on the configuration file. The scheduled queue processing determines which substring indexes and operation types should be executed in this period. A separate processing queue is used to execute these individual tasks. For insert and update operations, the full source table can be processed, or only the most recent changes (changes since the last processing) can be processed. For the remove operation, only the full substring index can be processed.
Scheduled background queue processing synchronization is configured using a period property (
synchronizationSchedulePeriod) and interval properties (
scheduleSynchronizeFullInsertInterval,
scheduleSynchronizeFullRemoveInterval,
scheduleSynchronizeFullUpdateInterval,
scheduleSynchronizeRecentInsertInterval, and
scheduleSynchronizeRecentUpdateInterval) specified in the
configuration file.
The configured period and interval properties together determine how frequently the synchronization occurs. For example, a period of 10 seconds and interval of 30 periods results in a synchronization frequency of once every 300 seconds. An interval value that is less than zero never synchronizes using queue processing. An interval value that is equal to zero only synchronizes once at method server startup.
Scheduled background queue processing has no impact on operations to the source objects due to substring index processing times. There is a delay between operations on source objects and the substring index synchronization. As a result, queries performed within this delay window may not be consistent with the current state of the source objects.
Manual Synchronization
Manual synchronization is performed using the sync operation with the subStringIndexTool. This operation immediately executes a full synchronization in the method server for the specified substring index.