Skip to content

Commit

Permalink
Merge pull request #19 from Financial-Times/video-mapping
Browse files Browse the repository at this point in the history
standfirst and description mapping
  • Loading branch information
peterschubert committed May 4, 2018
2 parents 91f44dd + 561ab3a commit ed51332
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
28 changes: 18 additions & 10 deletions service/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,24 @@ func populateContentRelatedFields(model *content.IndexModel, enrichedContent con
model.InitialPublish = &(enrichedContent.Content.FirstPublishedDate)
}
model.Body = new(string)
*model.Body = utils.TransformText(enrichedContent.Content.Body,
utils.InteractiveGraphicsMarkupTagRemover,
utils.PullTagTransformer,
utils.HtmlEntityTransformer,
utils.ScriptTagRemover,
utils.TagsRemover,
utils.OuterSpaceTrimmer,
utils.Embed1Replacer,
utils.SquaredCaptionReplacer,
utils.DuplicateWhiteSpaceRemover)
if enrichedContent.Content.Body != "" {
*model.Body = utils.TransformText(enrichedContent.Content.Body,
utils.InteractiveGraphicsMarkupTagRemover,
utils.PullTagTransformer,
utils.HtmlEntityTransformer,
utils.ScriptTagRemover,
utils.TagsRemover,
utils.OuterSpaceTrimmer,
utils.Embed1Replacer,
utils.SquaredCaptionReplacer,
utils.DuplicateWhiteSpaceRemover)
} else {
*model.Body = enrichedContent.Content.Description
}

model.ShortDescription = new(string)
*model.ShortDescription = enrichedContent.Content.Standfirst

if contentType != BlogType && enrichedContent.Content.MainImage != "" {
model.ThumbnailURL = new(string)

Expand Down
2 changes: 1 addition & 1 deletion service/testdata/exampleElasticModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"content_type": "article",
"provider_name": null,
"length_millis": 0,
"short_description": null,
"short_description": "Agitators are far from perfect, but they can play key role in spurring long-term thinking",
"thumbnail_url": "https://www.ft.com/__origami/service/image/v2/images/raw/http%3A%2F%2Fprod-upp-image-read.ft.com%2F5546cbc4-d4f7-47f9-3f3e-941fb0799c4f?source=search&fit=scale-down&width=167",
"section_link": null,
"secondary_image_id": null,
Expand Down
2 changes: 1 addition & 1 deletion service/testdata/testElasticModel1.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"content_type": "article",
"provider_name": null,
"length_millis": 0,
"short_description": null,
"short_description": "Founder of news aggregation app promises to respect ‘socialist values’",
"thumbnail_url": "",
"section_link": null,
"secondary_image_id": null,
Expand Down
2 changes: 1 addition & 1 deletion service/testdata/testElasticModel2.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"content_type": "article",
"provider_name": null,
"length_millis": 0,
"short_description": null,
"short_description": "standfirst",
"thumbnail_url": null,
"section_link": null,
"secondary_image_id": null,
Expand Down

0 comments on commit ed51332

Please sign in to comment.