Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

only show score when sorting by score

jonaswinklerf3703fc6e37c
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
index cabf4af41..d9132c9aa 100644
--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
@@ -83,7 +83,7 @@
<small>{{document.created | customDate:'mediumDate'}}</small>
</div>
- <div *ngIf="document.__search_hit__" class="list-group-item bg-light text-dark border-0 d-flex p-0 pl-4 search-score">
+ <div *ngIf="document.__search_hit__?.score" class="list-group-item bg-light text-dark border-0 d-flex p-0 pl-4 search-score">
<small class="text-muted" i18n>Score:</small>
<ngb-progressbar [type]="searchScoreClass" [value]="document.__search_hit__.score" class="search-score-bar mx-2 mt-1" [max]="1"></ngb-progressbar>
</div>
diff --git a/src/documents/index.py b/src/documents/index.py
index ce64c4b2f..cb302da45 100644
--- a/src/documents/index.py
+++ b/src/documents/index.py
@@ -246,11 +246,13 @@ class DelayedQuery:
sortedby is None):
self.first_score = page.results[0].score
- if self.first_score:
- page.results.top_n = list(map(
- lambda hit: (hit[0] / self.first_score, hit[1]),
- page.results.top_n
- ))
+ page.results.top_n = list(map(
+ lambda hit: (
+ (hit[0] / self.first_score) if self.first_score else None,
+ hit[1]
+ ),
+ page.results.top_n
+ ))
self.saved_results[item.start] = page