Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solr + MongoDB #5

Open
ricardobocchi opened this issue Oct 8, 2012 · 0 comments
Open

Solr + MongoDB #5

ricardobocchi opened this issue Oct 8, 2012 · 0 comments

Comments

@ricardobocchi
Copy link

Hi,

I was using the Grails Solr Plugin at an application with MmongoDB and I had some problems. When I started the application, I received an error in SolrGrailsPlugin.groovy. The closure that causes this error is:

def doWithApplicationContext = { applicationContext ->

  // add the event listeners for reindexing on change
  def listeners = applicationContext.sessionFactory.eventListeners
  def listener = new SolrIndexListener()

  ['postInsert', 'postUpdate', 'postDelete'].each({
     addEventTypeListener(listeners, listener, it)
  })
}

Then I modified the closure to test if hibernate's sessionFactory is null and then it works. I would like to now if is a bug or is a normal behavior. My corrected closure is:

def doWithApplicationContext = { applicationContext ->

  // add the event listeners for reindexing on change

   if(!applicationContext.sessionFactory)
        return

  def listeners = applicationContext.sessionFactory.eventListeners
  def listener = new SolrIndexListener()

  ['postInsert', 'postUpdate', 'postDelete'].each({
     addEventTypeListener(listeners, listener, it)
  })
}

Tanks
Ricardo Bocchi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant