mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Allow shorter search strings with Enter key
This commit is contained in:
		@@ -8,7 +8,7 @@
 | 
			
		||||
              <button *ngFor="let t of textFilterTargets" ngbDropdownItem [class.active]="textFilterTarget == t.id" (click)="changeTextFilterTarget(t.id)">{{t.name}}</button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <input #textFilterInput class="form-control form-control-sm" type="text" [(ngModel)]="textFilter" [readonly]="textFilterTarget == 'fulltext-morelike'">
 | 
			
		||||
          <input #textFilterInput class="form-control form-control-sm" type="text" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'">
 | 
			
		||||
         </div>
 | 
			
		||||
     </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -427,11 +427,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
        distinctUntilChanged(),
 | 
			
		||||
        filter((query) => !query.length || query.length > 2)
 | 
			
		||||
      )
 | 
			
		||||
      .subscribe((text) => {
 | 
			
		||||
        this._textFilter = text
 | 
			
		||||
        this.documentService.searchQuery = text
 | 
			
		||||
        this.updateRules()
 | 
			
		||||
      })
 | 
			
		||||
      .subscribe((text) => this.updateTextFilter(text))
 | 
			
		||||
 | 
			
		||||
    if (this._textFilter) this.documentService.searchQuery = this._textFilter
 | 
			
		||||
  }
 | 
			
		||||
@@ -476,6 +472,21 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
    this.documentTypeSelectionModel.apply()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateTextFilter(text) {
 | 
			
		||||
    this._textFilter = text
 | 
			
		||||
    this.documentService.searchQuery = text
 | 
			
		||||
    this.updateRules()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  textFilterEnter() {
 | 
			
		||||
    const filterString = (
 | 
			
		||||
      this.textFilterInput.nativeElement as HTMLInputElement
 | 
			
		||||
    ).value
 | 
			
		||||
    if (filterString.length) {
 | 
			
		||||
      this.updateTextFilter(filterString)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  changeTextFilterTarget(target) {
 | 
			
		||||
    if (
 | 
			
		||||
      this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE &&
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user