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

awards: fix description field and mappings #440

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion invenio_vocabularies/contrib/awards/datastreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def apply(self, stream_entry, **kwargs):
if "endDate" in record:
award["end_date"] = record["endDate"]
if "summary" in record:
award["description"] = record["summary"]
award["description"] = {"en": record["summary"]}

stream_entry.entry = award
return stream_entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"type": "string"
},
"description": {
"type": "string"
"$ref": "local://vocabularies/definitions-v1.0.0.json#/description"
},
"subjects": {
"description": "Award's subjects.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"type": "search_as_you_type"
}
}
},
{
"i18n_description": {
"path_match": "description.*",
"match_mapping_type": "string",
"mapping": {
"type": "text"
}
}
}
],
"dynamic": "strict",
Expand Down Expand Up @@ -70,7 +79,8 @@
"type": "date"
},
"description": {
"type": "text"
"type": "object",
"dynamic": "true"
},
"program": {
"type": "keyword"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"type": "search_as_you_type"
}
}
},
{
"i18n_description": {
"path_match": "description.*",
"match_mapping_type": "string",
"mapping": {
"type": "text"
}
}
}
],
"dynamic": "strict",
Expand Down Expand Up @@ -70,7 +79,8 @@
"type": "date"
},
"description": {
"type": "text"
"type": "object",
"dynamic": "true"
},
"program": {
"type": "keyword"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"type": "search_as_you_type"
}
}
},
{
"i18n_description": {
"path_match": "description.*",
"match_mapping_type": "string",
"mapping": {
"type": "text"
}
}
}
],
"dynamic": "strict",
Expand Down Expand Up @@ -70,7 +79,8 @@
"type": "date"
},
"description": {
"type": "text"
"type": "object",
"dynamic": "true"
},
"program": {
"type": "keyword"
Expand Down
2 changes: 0 additions & 2 deletions invenio_vocabularies/contrib/awards/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ class AwardSchema(BaseVocabularySchema, ModePIDFieldVocabularyMixin):

organizations = fields.List(fields.Nested(AwardOrganizationRelationSchema))

description = SanitizedUnicode()

start_date = ISODateString()

end_date = ISODateString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
}
}
},
"description": {
"type": "object",
"description": "Description of vocabulary item. Keys are locale codes.",
"patternProperties": {
"^[a-z]{2}$": {
"type": "string"
}
}
},
"icon": {
"type": "string"
},
Expand Down