Skip to content

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

Add minimum length to text filter

Michael Shamoon4f352391ae90
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
index 11ed97ef1..4d0ff7c17 100644
--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
@@ -12,7 +12,7 @@ import { PaperlessTag } from 'src/app/data/paperless-tag'
import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'
import { PaperlessDocumentType } from 'src/app/data/paperless-document-type'
import { Subject, Subscription } from 'rxjs'
-import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
+import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators'
import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
import { TagService } from 'src/app/services/rest/tag.service'
import { CorrespondentService } from 'src/app/services/rest/correspondent.service'
@@ -422,7 +422,11 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
this.textFilterDebounce = new Subject<string>()
this.subscription = this.textFilterDebounce
- .pipe(debounceTime(400), distinctUntilChanged())
+ .pipe(
+ debounceTime(400),
+ distinctUntilChanged(),
+ filter((query) => !query.length || query.length > 2)
+ )
.subscribe((text) => {
this._textFilter = text
this.documentService.searchQuery = text