(search) Clean up search results template

Rendering is very slow. Let's see if this has a measurable effect on latency.
This commit is contained in:
Viktor Lofgren 2024-01-08 20:57:40 +01:00
parent c80d3eb812
commit 68fd0efbde
2 changed files with 12 additions and 17 deletions

View File

@ -104,18 +104,14 @@ public class UrlDetails {
public int getProblemCount() { public int getProblemCount() {
int numProblems = 0; int numProblems = 0;
for (var problem :EnumSet.of( int mask = HtmlFeature.JS.getFeatureBit()
HtmlFeature.JS, | HtmlFeature.COOKIES.getFeatureBit()
HtmlFeature.TRACKING, | HtmlFeature.TRACKING.getFeatureBit()
HtmlFeature.TRACKING_ADTECH, | HtmlFeature.AFFILIATE_LINK.getFeatureBit()
HtmlFeature.AFFILIATE_LINK, | HtmlFeature.TRACKING_ADTECH.getFeatureBit()
HtmlFeature.COOKIES, | HtmlFeature.ADVERTISEMENT.getFeatureBit();
HtmlFeature.ADVERTISEMENT)) {
if (HtmlFeature.hasFeature(features, problem)) { return Integer.bitCount(features & mask);
numProblems++;
}
}
return numProblems;
} }
public String getProblems() { public String getProblems() {

View File

@ -1,5 +1,5 @@
<section {{#unless hideRanking}} data-rs-rank="{{logRank}}" data-ms-rank="{{matchRank}}"{{/unless}} <section data-rs-rank="{{logRank}}" data-ms-rank="{{matchRank}}"
class="card search-result {{#if specialDomain}}special-domain{{/if}}" > class="card search-result" >
<div class="url"><a rel="nofollow external" href="{{url}}">{{url}}</a></div> <div class="url"><a rel="nofollow external" href="{{url}}">{{url}}</a></div>
<h2> <a tabindex="-1" class="title" rel="nofollow external" href="{{url}}">{{title}}</a> </h2> <h2> <a tabindex="-1" class="title" rel="nofollow external" href="{{url}}">{{title}}</a> </h2>
<p class="description">{{description}}</p> <p class="description">{{description}}</p>
@ -7,10 +7,9 @@
<div class="utils"> <div class="utils">
{{#unless focusDomain}} {{#unless focusDomain}}
<a href="/site/{{url.domain}}" title="Domain Information">Info</a> <a href="/site/{{url.domain}}" title="Domain Information">Info</a>
{{#if hasMoreResults}}<a href="/site-search/{{url.domain}}/{{query}}?profile={{profile}}" title="More results from this domain">{{resultsFromSameDomain}}+</a>{{/if}} {{#if hasMoreResults}}<a href="/site-search/{{url.domain}}/{{query}}?profile={{profile}}" title="More results from this domain">{{resultsFromSameDomain}}+</a>{{/if}}{{/unless}}
{{/unless}}
<div class="meta"> <div class="meta">
{{#if problems}} <span class="problems" title="{{problems}}"> ⚠ {{problemCount}} </span> {{/if}} {{#if problemCount}} <span class="problems" title="{{problems}}"> ⚠ {{problemCount}} </span> {{/if}}
<span aria-hidden="true" class="meta positions" <span aria-hidden="true" class="meta positions"
title="Positions where keywords were found within the document">{{positions}}</span> title="Positions where keywords were found within the document">{{positions}}</span>
</div> </div>