A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: prevent duplicated text query with multiple date queries (#13522)
shamoon41d5d866372e
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.tsindex 1cf05b781..9fa7f7807 100644--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts@@ -1697,6 +1697,24 @@ describe('FilterEditorComponent', () => {])})+ it('should carry over text filtering once with created and added relative dates', () => {+ component.textFilter = 'foo'+ const datesDropdown = fixture.debugElement.query(+ By.directive(DatesDropdownComponent)+ )+ component.dateCreatedRelativeDate = RelativeDate.WITHIN_1_WEEK+ component.dateAddedRelativeDate = RelativeDate.WITHIN_1_MONTH+ datesDropdown.triggerEventHandler('datesSet')+ fixture.detectChanges()+ tick(400)+ expect(component.filterRules).toEqual([+ {+ rule_type: FILTER_FULLTEXT_QUERY,+ value: 'foo,created:[-1 week to now],added:[-1 month to now]',+ },+ ])+ })+it('should convert legacy title filters into full text query when adding a created relative date', () => {component.filterRules = [{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.tsindex d747002b2..537187597 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@@ -1016,7 +1016,6 @@ export class FilterEditorComponentthis.dateAddedRelativeDate !== null ||this.dateCreatedRelativeDate !== null) {- let queryArgs: Array<string> = []let existingRule = filterRules.find((fr) => fr.rule_type == FILTER_FULLTEXT_QUERY)@@ -1038,32 +1037,28 @@ export class FilterEditorComponentexistingRule.rule_type = FILTER_FULLTEXT_QUERY}- let existingRuleArgs = existingRule?.value.split(',')+ let queryArgs = existingRule?.value.split(',') ?? []if (this.dateCreatedRelativeDate !== null) {const rd = RELATIVE_DATE_QUERYSTRINGS.find((qS) => qS.relativeDate == this.dateCreatedRelativeDate)+ queryArgs = queryArgs.filter(+ (arg) => !arg.match(RELATIVE_DATE_QUERY_REGEXP_CREATED)+ )queryArgs.push(`created:${rd.isRange ? `[${rd.dateQuery}]` : `"${rd.dateQuery}"`}`)- if (existingRule) {- queryArgs = existingRuleArgs- .filter((arg) => !arg.match(RELATIVE_DATE_QUERY_REGEXP_CREATED))- .concat(queryArgs)- }}if (this.dateAddedRelativeDate !== null) {const rd = RELATIVE_DATE_QUERYSTRINGS.find((qS) => qS.relativeDate == this.dateAddedRelativeDate)+ queryArgs = queryArgs.filter(+ (arg) => !arg.match(RELATIVE_DATE_QUERY_REGEXP_ADDED)+ )queryArgs.push(`added:${rd.isRange ? `[${rd.dateQuery}]` : `"${rd.dateQuery}"`}`)- if (existingRule) {- queryArgs = existingRuleArgs- .filter((arg) => !arg.match(RELATIVE_DATE_QUERY_REGEXP_ADDED))- .concat(queryArgs)- }}if (existingRule) {