Changeset 622 for trunk/grails-app/jobs


Ignore:
Timestamp:
Jul 10, 2010, 10:48:50 PM (14 years ago)
Author:
gav
Message:

Apply bug fix for ticket #76.
Rename all instances of Lucene to Searchable.
Improved global directory config.
Add log levels for searchable plugin and compass.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/jobs/InventoryIndexJob.groovy

    r620 r622  
    1 import org.codehaus.groovy.grails.commons.*
     1import org.codehaus.groovy.grails.commons.ConfigurationHolder
    22
    33/**
    4 * Provides a quartz job that reindex's the Lucene index for the Inventory domain class.
    5 * With concurrent=false the repeat interval starts after the previous job completes.
     4* Provides a quartz job that rebuilds the searchable index for the inventory search.
     5* With concurrent=false the next job is blocked until the previous job completes.
    66* We need a hibernate session otherwise we get a LazyInitializationException, default is true but we specify it to be sure.
     7* Rebuilding the index is required since searchable components are not updated when they change, that is
     8* until the parent is updated and reindexed. Cascade update is broken in searchable-0.5.5
    79*/
    8 class InventoryReindexJob {
     10class InventoryIndexJob {
    911
    1012    def concurrent = false
     
    1618        // See: http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html
    1719        // Trigger every hour on the hour:
    18         cron name: 'RebuildInventoryIndex', cronExpression: "0 0 * * * ?"
     20        //cron name: 'RebuildInventoryIndex', cronExpression: "0 0 * * * ?"
    1921    }
    2022
    21     def execute() {
     23    def execute(context) {
    2224
    2325        // Some information can be accessed if we run with "def execute(context) ".
     
    2729        // log.debug context.getFireTime()
    2830
    29         // Reindex the Inventory domain class.
    30         log.info "Rebuilding Lucene index, Inventory.reindex()."
    31         InventoryItem.reindex()
    32         log.info "Rebuilding Lucene index, complete."
     31        // Called by.
     32        def calledBy =  context.mergedJobDataMap.get('calledBy')
     33        log.info "Called By: " + calledBy
     34
     35        // Rebuild the Inventory searchable index.
     36        log.info "Calling, Inventory.index()."
     37        InventoryItem.index()
    3338    }
    3439}
Note: See TracChangeset for help on using the changeset viewer.