Skip to content

Commit f273257

Browse files
committed
instantsearch.js: Avoid sample only repeating single searched term; Fix URL decoding
1 parent 04b3de0 commit f273257

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/js/instantsearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function (global, doc) {
22
let match;
33
const search_query = (match = doc.location.search.match(/sq=(.*?)(&|$)/)) ? match[1] : '';
4-
const parsed_search_query = decodeURI(search_query.replace('+', ' '));
4+
const parsed_search_query = decodeURI(search_query.replaceAll('+', ' '));
55
const search_page = (match = doc.location.search.match(/p=(\d*?)(&|$)/)) ? match[1] : 1;
66
const parsed_search_page = parseInt(search_page);
77
let version = doc.location.pathname.split('/')[2];
@@ -68,7 +68,7 @@
6868
let breadcrumbsHTML = '';
6969
let contentHTML = '';
7070

71-
if (hit.content && !hit._highlightResult.content.fullyHighlighted && hit._highlightResult.content.matchedWords.length) {
71+
if (hit.content && hit._highlightResult.content.matchedWords.length && (!hit._highlightResult.content.fullyHighlighted || 1 < hit._highlightResult.content.matchedWords.length)) {
7272
contentHTML = `<div class="instantsearch__entry-content">
7373
${instantsearch.highlight({
7474
attribute: `content`,

0 commit comments

Comments
 (0)