Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Updating field names

Clément Habinshuti edited this page Jul 11, 2017 · 1 revision

Updating field names

Contents:

After updating template field names in Casebox, you should run the update_fields.php in the bin directory so that the change might also take effect across objects that used that field.

Updating objects with new field names

Step 1: Run the update script

To run the script, cd into the bin directory and run

php update_fields -c <corename> -f <fields> -t <templates>

where:

  • corename is the name of the core
  • fields is a list of field name updates in the form oldName1:newName1,oldName2:newName2
  • templates (optional) is a list of template id's to restrict the update to, in the form id1,id2. If this option is not provided, the script will update all objects.

Example:

php update_fields -c acore -f en:title_en,ru:title_ru -t 102,7343

will update all objects based on templates 102 and 7343, changing their fields from en to title_en and ru to title_ru in the core called acore.

php update_fields -c bcore -f name:victim_name

will change the field name to victim_name on all objects in core called bcore.

Step 2: Reindex the solr core

After running the script, you should update the solr index so that the changes may be visible on the Casebox UI.

Update data for solr indexing:

php update_solr_prepared_data.php -c <corename> -at

Then reindex the solr core:

php solr_reindex_core.php -c <corename> -al

Why running the script is required

When you modify and update the configuration of a template field in Casebox and change the field's name, objects based on that template are not automatically updated and will still display the old field name. The tree will be updated, but not not actual objects data.

Since the entries in the core's objects table are not updated, solr data will not be updated as well and the index will not be updated. As a result, things that depend on this, such as faceting and search, won't work properly for the update field.

The script updates the data in the objects, after which you can update the data used for solr index and the reindex the solr core. Then changes will take effect on the user's end.

Limitations

This script currently does not support child/nested fields.