6464 class =" search-content__results-container"
6565 >
6666 <div class =" search-content__summary" aria-live =" polite" aria-atomic =" true" >
67- Found {{ matchesSummary }} {{ negateSearch ? 'NOT' : '' }} containing "<strong >{{
68- searchTerm
69- }}</strong
70- >"
67+ <template v-if =" negateSearch " >
68+ Found {{ matchesSummary }} NOT containing "<strong >{{ searchTerm }}</strong
69+ >"
70+ </template >
71+ <template v-else >
72+ Found {{ matchesSummary }} containing "<strong >{{ searchTerm }}</strong
73+ >"
74+ </template >
7175 </div >
72- <div class =" results -list" >
76+ <div class =" search-content__results -list" >
7377 <Card
7478 v-for =" (result, index) in results"
7579 :key =" index"
@@ -304,8 +308,11 @@ const matchesByScope = computed(() => {
304308
305309 results .value .forEach ((result ) => {
306310 const sourceType = result .sourceType || ' Unknown'
307- const matchCount = result .matches .reduce ((sum , m ) => sum + (m .count || 1 ), 0 )
308- scopeMap .set (sourceType , (scopeMap .get (sourceType ) || 0 ) + matchCount )
311+ // For exclusive search, count items; for inclusive search, count matches
312+ const count = negateSearch .value
313+ ? 1
314+ : result .matches .reduce ((sum , m ) => sum + (m .count || 1 ), 0 )
315+ scopeMap .set (sourceType , (scopeMap .get (sourceType ) || 0 ) + count )
309316 })
310317
311318 return Array .from (scopeMap .entries ())
@@ -314,14 +321,18 @@ const matchesByScope = computed(() => {
314321})
315322
316323const matchesSummary = computed (() => {
317- const total = totalMatches .value
324+ const total = negateSearch . value ? results . value . length : totalMatches .value
318325 if (matchesByScope .value .length === 0 ) return ' '
319326
320327 const scopeBreakdown = matchesByScope .value
321328 .map (({ scope , count }) => ` ${count } in ${scope } ` )
322329 .join (' , ' )
323330
324- return ` ${total } ${pluralize (total , ' match' , ' matches' )}: ${scopeBreakdown } `
331+ const unit = negateSearch .value
332+ ? pluralize (total , ' item' , ' items' )
333+ : pluralize (total , ' match' , ' matches' )
334+
335+ return ` ${total } ${unit }: ${scopeBreakdown } `
325336})
326337
327338function getResultMatchCount(
@@ -378,7 +389,7 @@ function getResultMatchCount(
378389 }
379390
380391 // Results list
381- .results -list {
392+ & __results -list {
382393 display : flex ;
383394 flex-direction : column ;
384395 gap : var (--space-5 );
0 commit comments