(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 cb55273769
commit d4b0539d39
2 changed files with 12 additions and 17 deletions

View File

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

View File

@ -1,5 +1,5 @@
<section {{#unless hideRanking}} data-rs-rank="{{logRank}}" data-ms-rank="{{matchRank}}"{{/unless}}
class="card search-result {{#if specialDomain}}special-domain{{/if}}" >
<section data-rs-rank="{{logRank}}" data-ms-rank="{{matchRank}}"
class="card search-result" >
<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>
<p class="description">{{description}}</p>
@ -7,10 +7,9 @@
<div class="utils">
{{#unless focusDomain}}
<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}}
{{/unless}}
{{#if hasMoreResults}}<a href="/site-search/{{url.domain}}/{{query}}?profile={{profile}}" title="More results from this domain">{{resultsFromSameDomain}}+</a>{{/if}}{{/unless}}
<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"
title="Positions where keywords were found within the document">{{positions}}</span>
</div>