| 154 | |
| 155 | template<typename ObjType> |
| 156 | void load( const es_objects_plugin_impl::plugin_options::object_options& opt, |
| 157 | bool force_delete = false ) |
| 158 | { |
| 159 | if( !opt.enabled ) |
| 160 | return; |
| 161 | |
| 162 | // If no_delete or store_updates is true, do not delete |
| 163 | if( force_delete || !( opt.no_delete || opt.store_updates ) ) |
| 164 | { |
| 165 | ilog( "Deleting all data in index " + my->_options.index_prefix + opt.index_name ); |
| 166 | my->delete_all_from_database( opt ); |
| 167 | } |
| 168 | |
| 169 | ilog( "Loading data into index " + my->_options.index_prefix + opt.index_name ); |
| 170 | db.get_index( ObjType::space_id, ObjType::type_id ).inspect_all_objects( |
| 171 | [this, &opt](const graphene::db::object &o) { |
| 172 | my->prepareTemplate( static_cast<const ObjType&>(o), opt ); |
| 173 | }); |
| 174 | my->send_bulk_if_ready(true); |
| 175 | my->docs_sent_batch = 0; |
| 176 | } |
| 177 | }; |
| 178 | |
| 179 | void es_objects_plugin_impl::sync_db( bool delete_before_load ) |