diff --git a/ckanext/harvest/plugin/__init__.py b/ckanext/harvest/plugin/__init__.py index b66cbf10..5eabbe09 100644 --- a/ckanext/harvest/plugin/__init__.py +++ b/ckanext/harvest/plugin/__init__.py @@ -138,8 +138,11 @@ def before_dataset_index(self, pkg_dict): already exist in the root schema. Note: If another extension adds any harvest extra to the `package_show` - schema then this method will add them again in the `extras` field to avoid + schema then this method will not add them again in the `extras` field to avoid validation errors when updating a package. + + If the harvest extra has been added to the root schema, then we will not update + them since it is responsibility of the package validators to do it. """ # Fix to support Solr8 if isinstance(pkg_dict.get('status'), dict): @@ -180,7 +183,8 @@ def before_dataset_index(self, pkg_dict): # Add harvest extras to main indexed pkg_dict for key, value in harvest_extras: - pkg_dict[key] = value + if key not in pkg_dict.keys(): + pkg_dict[key] = value pkg_dict["data_dict"] = json.dumps(data_dict) pkg_dict["validated_data_dict"] = json.dumps(validated_data_dict)