diff --git a/frontend/app/search/search.controller.js b/frontend/app/search/search.controller.js index 5280dcb94..c9541b33f 100644 --- a/frontend/app/search/search.controller.js +++ b/frontend/app/search/search.controller.js @@ -85,31 +85,39 @@ export default function ($rootScope, $scope, searchService, categoryService, $fi if (!section.content || section.content.length === 0) return ""; - var sectionText = ""; + let sectionText = ""; if (section.label && section.label.length > 0) { - sectionText += firstLevel ? "#" : "###"; - sectionText += " " + section.label + "\n"; + // skip technical labels ("raw" and "formatted") + if(section.label !== "raw" && section.label !== "formatted") { + sectionText += firstLevel ? "#" : "###"; + sectionText += " " + section.label + "\n"; + } } - for (var i in section.content) { - if (section.content[i].value) { - var value = ""; - if (Array.isArray(section.content[i].value)) { - for (var j in section.content[i].value) { - value += section.content[i].value[j] + " \n"; + // process nested sections + if(section.content.label !== "raw") { + for (let i in section.content) { + // use "formatted"-parts only + if(section.content[i].label !== "raw") { + if(section.content[i].value) { + let value = ""; + if (Array.isArray(section.content[i].value)) { + for (let j in section.content[i].value) { + value += section.content[i].value[j] + " \n"; + } + } else { + value = section.content[i].value; + } + value = value.replace(/