-
-
-
-
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
index a1a74d60..7894a652 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,7 @@
- ${instantsearch.snippet({ hit: hit, attribute: 'content' })} -
` - } + return + } - if (hit.breadcrumbs) { - breadcrumbs = `` + const nbHits = hits.length + const counterEl = document.querySelector('#page-counter') + counterEl.innerHTML = `${nbHits} result${nbHits > 1 ? 's' : ''} found` + document.querySelector('#page-counter').style.display = 'block' + + container.querySelector('ul').innerHTML = hits + .map((hit) => { + const titles = Array.isArray(hit.titles) ? hit.titles : [] + const searchTerms = Array.isArray(hit.searchTerms) ? hit.searchTerms : [] + + const rawParentTitle = hit.title || 'Untitled' + const parentTitle = highlightText(rawParentTitle, searchTerms) + + const lowerTerms = searchTerms.map((t) => t.toLowerCase()) + const matchesTerms = (t) => { + if (!t || !lowerTerms.length) return false + const raw = t.text || '' + const snippet = buildSnippet(raw, searchTerms) || '' + const haystack = `${t.title || ''} ${snippet}`.toLowerCase() + if (!haystack.trim()) return false + return lowerTerms.some((term) => term && haystack.includes(term)) + } + + // For Antora index, hit.ref is like '108-1' where the second segment is the section id + let matchedChildId = null + if (usingAntoraIndex && hit.ref) { + const refStr = String(hit.ref) + const parts = refStr.split('-') + if (parts.length > 1) { + const maybeId = parseInt(parts[1], 10) + if (!isNaN(maybeId)) matchedChildId = maybeId } + } - label = Object.keys(hit.hierarchy) - .map((key, index) => { - if (index > 0 && hit) { - return instantsearch.highlight({ hit: hit, attribute: 'hierarchy.' + key }) - } - return null - }) - .filter((item) => !!item) - .join(' - ') - - return `- ${instantsearch.snippet({ hit: hit, attribute: 'content' })} -
` - } + return + } + + const nbHits = hits.length + document.querySelector('#counter').innerHTML = `${nbHits} result${nbHits > 1 ? 's' : ''} found` + document.querySelector('#counter').style.display = 'block' + + container.querySelector('ul').innerHTML = hits + .map((hit) => { + const titles = Array.isArray(hit.titles) ? hit.titles : [] + const searchTerms = Array.isArray(hit.searchTerms) ? hit.searchTerms : [] + + const rawParentTitle = hit.title || 'Untitled' + const parentTitle = highlightText(rawParentTitle, searchTerms) - if (hit.breadcrumbs) { - breadcrumbs = `` + const lowerTerms = searchTerms.map((t) => t.toLowerCase()) + const matchesTerms = (t) => { + if (!t || !lowerTerms.length) return false + const raw = t.text || '' + const snippet = buildSnippet(raw, searchTerms) || '' + const haystack = `${t.title || ''} ${snippet}`.toLowerCase() + if (!haystack.trim()) return false + return lowerTerms.some((term) => term && haystack.includes(term)) + } + + // For Antora index, hit.ref is like '108-1' where the second segment is the section id + let matchedChildId = null + if (usingAntoraIndex && hit.ref) { + const refStr = String(hit.ref) + const parts = refStr.split('-') + if (parts.length > 1) { + const maybeId = parseInt(parts[1], 10) + if (!isNaN(maybeId)) matchedChildId = maybeId } - label = Object.keys(hit.hierarchy) - .map((key, index) => { - if (index > 0 && hit) { - return instantsearch.highlight({ hit: hit, attribute: 'hierarchy.' + key }) - } - return null - }) - .filter((item) => !!item) - .join(' - ') - - return `