Skip to content

Commit

Permalink
Do not print identical search snippets twice. Fixes alphagov/tech-doc…
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisnyman committed Aug 1, 2018
1 parent fd6bf64 commit fe6ebea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/assets/javascripts/_modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@
break;
}

var containsMark = sentences[i].includes('mark>');
if (containsMark) {
selectedSentences.push(sentences[i].trim());
var sentence = sentences[i].trim();
var containsMark = sentence.includes('mark>');
if (containsMark && (selectedSentences.indexOf(sentence) == -1)) {
selectedSentences.push(sentence);
}
}
if(selectedSentences.length > 0) {
Expand Down

0 comments on commit fe6ebea

Please sign in to comment.