开发者

Is bulkIndexOnStartup needed when using mirrorChanges = true in Grails Searchable plugin?

开发者 https://www.devze.com 2023-01-27 07:48 出处:网络
The mirrorChanges option will mirror all changes made through GORM/Hibernate, so if I\'m not making any external changes to the database, then is bulkIndexOnStartup needed?

The mirrorChanges option will mirror all changes made through GORM/Hibernate, so if I'm not making any external changes to the database, then is bulkIndexOnStartup needed?

The problem is that开发者_高级运维 our data set is very large (>1M rows) and the bulk indexer may take 30+ minutes.

When set to 'fork' lucene will crash if any changes are made though the GORM, because lucene is not thread safe and the GORM transaction will attempt to update the index while the forked bulk index thread is running.

When set to true, the application will finish initializing for those 30+ minutes.


If you are not modifying the data from another source, then you don't need to set bulkIndexOnStartup to true, specially if you set mirrorChanges to true. This is pretty much how we handle it in our application. We have a controller action that calls the indexer, forked, for a specific class so we can call it on demand in case we need to, for example if for some reason we needed to update the database directly. We then call the indexer for a specific class and not the entire set of class, in that way if we need to call it then it won't take that long.


bulkIndexOnStartup should not be needed if you are mirroring changes.

we have a much smaller dataset so we actually do bulkIndexOnStartup with 'fork' set as an option when we do releases as more of a maintenance task

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号