mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	fix search scores
This commit is contained in:
		@@ -62,10 +62,6 @@
 | 
				
			|||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          <div class="list-group list-group-horizontal border-0 card-info ml-md-auto mt-2 mt-md-0">
 | 
					          <div class="list-group list-group-horizontal border-0 card-info ml-md-auto mt-2 mt-md-0">
 | 
				
			||||||
            <div *ngIf="document.__search_hit__" class="list-group-item bg-light text-dark p-1 mr-5 border-0 d-flex 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>
 | 
					 | 
				
			||||||
            <button *ngIf="document.document_type" type="button" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 mr-2" title="Filter by document type"
 | 
					            <button *ngIf="document.document_type" type="button" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 mr-2" title="Filter by document type"
 | 
				
			||||||
             (click)="clickDocumentType.emit(document.document_type);$event.stopPropagation()">
 | 
					             (click)="clickDocumentType.emit(document.document_type);$event.stopPropagation()">
 | 
				
			||||||
              <svg class="metadata-icon mr-2 text-muted bi bi-file-earmark" viewBox="0 0 16 16" fill="currentColor">
 | 
					              <svg class="metadata-icon mr-2 text-muted bi bi-file-earmark" viewBox="0 0 16 16" fill="currentColor">
 | 
				
			||||||
@@ -86,6 +82,10 @@
 | 
				
			|||||||
              </svg>
 | 
					              </svg>
 | 
				
			||||||
              <small>{{document.created | customDate:'mediumDate'}}</small>
 | 
					              <small>{{document.created | customDate:'mediumDate'}}</small>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					            <div *ngIf="document.__search_hit__" class="list-group-item bg-light text-dark border-0 d-flex 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>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,23 +41,22 @@ export class DocumentCardLargeComponent implements OnInit {
 | 
				
			|||||||
  @Output()
 | 
					  @Output()
 | 
				
			||||||
  clickMoreLike= new EventEmitter()
 | 
					  clickMoreLike= new EventEmitter()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Input()
 | 
					 | 
				
			||||||
  searchScore: number
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @ViewChild('popover') popover: NgbPopover
 | 
					  @ViewChild('popover') popover: NgbPopover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mouseOnPreview = false
 | 
					  mouseOnPreview = false
 | 
				
			||||||
  popoverHidden = true
 | 
					  popoverHidden = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  get searchScoreClass() {
 | 
					  get searchScoreClass() {
 | 
				
			||||||
    if (this.searchScore > 0.7) {
 | 
					    if (this.document.__search_hit__) {
 | 
				
			||||||
 | 
					      if (this.document.__search_hit__.score > 0.7) {
 | 
				
			||||||
        return "success"
 | 
					        return "success"
 | 
				
			||||||
    } else if (this.searchScore > 0.3) {
 | 
					      } else if (this.document.__search_hit__.score > 0.3) {
 | 
				
			||||||
        return "warning"
 | 
					        return "warning"
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        return "danger"
 | 
					        return "danger"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit(): void {
 | 
					  ngOnInit(): void {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user