(search) Add screenreader-only positions count text to search results

This commit is contained in:
Viktor Lofgren 2024-05-01 16:22:20 +02:00
parent 9fecfc5025
commit 2840d9d403
3 changed files with 3 additions and 0 deletions

View File

@ -30,6 +30,7 @@ public class UrlDetails implements Comparable<UrlDetails> {
public int resultsFromSameDomain;
public String positions;
public int positionsCount;
public SearchResultItem resultItem;
public List<SearchResultKeywordScore> keywordScores;

View File

@ -89,6 +89,7 @@ public class SearchQueryIndexService {
detail.rankingScore, // termScore
detail.resultsFromDomain(),
getPositionsString(detail),
Long.bitCount(detail.bestPositions),
detail.rawIndexResult,
detail.rawIndexResult.keywordScores
));

View File

@ -13,6 +13,7 @@
{{#if problemCount}} <span class="problems" title="{{problems}}"> ⚠ {{problemCount}} </span> {{/if}}
<span aria-hidden="true" class="meta positions"
title="Positions where keywords were found within the document">{{positions}}</span>
<div class="screenreader-only">Terms appear in {{positionsCount}} positions</div>
</div>
</div>
</section>