Skip to content

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

Updated to work with new unified search interface

Michael Shamoon3d0891c73b0e
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 b693c55ec..23c3d810a 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
@@ -290,9 +290,12 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
distinctUntilChanged()
).subscribe(text => {
this._textFilter = text
- this.documentService.setSearchQuery(text)
+ this.documentService.searchQuery = text
this.updateRules()
})
+
+ if (this._textFilter) this.documentService.searchQuery = this._textFilter
+
}
ngOnDestroy() {
diff --git a/src-ui/src/app/services/rest/document.service.ts b/src-ui/src/app/services/rest/document.service.ts
index 40a400f0c..712b0492f 100644
--- a/src-ui/src/app/services/rest/document.service.ts
+++ b/src-ui/src/app/services/rest/document.service.ts
@@ -12,7 +12,6 @@ import { DocumentTypeService } from './document-type.service';
import { TagService } from './tag.service';
import { FILTER_RULE_TYPES } from 'src/app/data/filter-rule-type';
import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions';
-import { ActivatedRoute } from '@angular/router';
export const DOCUMENT_SORT_FIELDS = [
{ field: 'archive_serial_number', name: $localize`ASN` },
@@ -40,14 +39,10 @@ export interface SelectionData {
})
export class DocumentService extends AbstractPaperlessService<PaperlessDocument> {
- private searchQuery: string
+ private _searchQuery: string
- constructor(http: HttpClient, private correspondentService: CorrespondentService, private documentTypeService: DocumentTypeService, private tagService: TagService, private route: ActivatedRoute) {
+ constructor(http: HttpClient, private correspondentService: CorrespondentService, private documentTypeService: DocumentTypeService, private tagService: TagService) {
super(http, 'documents')
-
- this.route.queryParamMap.subscribe(paramMap => {
- this.searchQuery = paramMap.get('query')
- })
}
private filterRulesToQueryParams(filterRules: FilterRule[]) {
@@ -99,7 +94,7 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>
getPreviewUrl(id: number, original: boolean = false): string {
let url = this.getResourceUrl(id, 'preview')
- if (this.searchQuery) url += `#search="${this.searchQuery}"`
+ if (this._searchQuery) url += `#search="${this._searchQuery}"`
if (original) {
url += "?original=true"
}
@@ -146,8 +141,8 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>
return this.http.post(this.getResourceUrl(null, 'bulk_download'), {"documents": ids, "content": content}, { responseType: 'blob' })
}
- public setSearchQuery(query: string) {
- this.searchQuery = query
+ public set searchQuery(query: string) {
+ this._searchQuery = query
}
}