schedule a reindex?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2012 07:22 AM
I was wondering if anyone has figured out how to create a scheduled-job that performs a text-index (specifically sc_cat_item) on a table. Currently, I need to manually index each time after publishing new catalog items.
I have found the UI action + scripting that creates the "Regenerate Text Index" popup, however this does not translate directly into a scheduled-job, as it appears to require human interaction to push a button. The Wiki also references several Zing scheduled-jobs, but I they do not show any actual code.
Thanks!
Labels:
- Labels:
-
Service Catalog
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2012 05:12 AM
A re-index can be triggered by firing the
event for the table.
text_index.all
The below snippet should create the event with the appropriate parameters, and place it the text_index queue, the table will be re-indexed once the index job runs.
fireTableIndexEvent('sc_cat_item', 'myemail@example.com')
/**
* Fires an event which will cause the entire table to be re-indexed
*
* @param {string} tableName The table to be re-indexed
* @param {string} notifyEmailAddress The email address to be notified once the indexing is complete (optional)
*/
function fireTableIndexEvent(tableName, notifyEmailAddress) {
gs.eventQueue('text_index.all', null, tableName, notifyEmailAddress, 'text_index');
}
Try to schedule this at a time of low system usage, to minimise the chance of it affecting your end-users.
Rather than having this run every night, I typically include a re-index of sc_cat_item as part of the post-deploy activities when applying Update Sets to a target instance.