Skip to content

Commit

Permalink
awards: fix description field and mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
yashlamba authored and slint committed Nov 25, 2024
1 parent 8aaa881 commit d0ecfbc
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
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

0 comments on commit d0ecfbc

Please sign in to comment.