]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
only show score when sorting by score
authorjonaswinkler <17569239+jonaswinkler@users.noreply.github.com>
Sat, 15 May 2021 15:25:49 +0000 (17:25 +0200)
committerjonaswinkler <17569239+jonaswinkler@users.noreply.github.com>
Sat, 15 May 2021 15:25:49 +0000 (17:25 +0200)
src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
src/documents/index.py

index cabf4af412a8ca0e969b169b62d7291d5eed5691..d9132c9aa1fbda0a89eb6e9b722a2a288ce0dc70 100644 (file)
@@ -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>
index ce64c4b2fc0c09b1a9ac22a49807a83690261ddf..cb302da4594a8fea4241f4d05b71934e32008579 100644 (file)
@@ -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