mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix switch from title_content search
This commit is contained in:
		| @@ -271,8 +271,9 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | |||||||
|           this.textFilterTarget = TEXT_FILTER_TARGET_ASN |           this.textFilterTarget = TEXT_FILTER_TARGET_ASN | ||||||
|           break |           break | ||||||
|         case FILTER_FULLTEXT_QUERY: |         case FILTER_FULLTEXT_QUERY: | ||||||
|           let queryArgs = rule.value.split(',') |           let allQueryArgs = rule.value.split(',') | ||||||
|           queryArgs.forEach((arg) => { |           let textQueryArgs = [] | ||||||
|  |           allQueryArgs.forEach((arg) => { | ||||||
|             if (arg.match(RELATIVE_DATE_QUERY_REGEXP_CREATED)) { |             if (arg.match(RELATIVE_DATE_QUERY_REGEXP_CREATED)) { | ||||||
|               ;[...arg.matchAll(RELATIVE_DATE_QUERY_REGEXP_CREATED)].forEach( |               ;[...arg.matchAll(RELATIVE_DATE_QUERY_REGEXP_CREATED)].forEach( | ||||||
|                 (match) => { |                 (match) => { | ||||||
| @@ -284,9 +285,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | |||||||
|                   } |                   } | ||||||
|                 } |                 } | ||||||
|               ) |               ) | ||||||
|               queryArgs.splice(queryArgs.indexOf(arg), 1) |             } else if (arg.match(RELATIVE_DATE_QUERY_REGEXP_ADDED)) { | ||||||
|             } |  | ||||||
|             if (arg.match(RELATIVE_DATE_QUERY_REGEXP_ADDED)) { |  | ||||||
|               ;[...arg.matchAll(RELATIVE_DATE_QUERY_REGEXP_ADDED)].forEach( |               ;[...arg.matchAll(RELATIVE_DATE_QUERY_REGEXP_ADDED)].forEach( | ||||||
|                 (match) => { |                 (match) => { | ||||||
|                   if (match[1]?.length) { |                   if (match[1]?.length) { | ||||||
| @@ -297,11 +296,12 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | |||||||
|                   } |                   } | ||||||
|                 } |                 } | ||||||
|               ) |               ) | ||||||
|               queryArgs.splice(queryArgs.indexOf(arg), 1) |             } else { | ||||||
|  |               textQueryArgs.push(arg) | ||||||
|             } |             } | ||||||
|           }) |           }) | ||||||
|           if (queryArgs.length) { |           if (textQueryArgs.length) { | ||||||
|             this._textFilter = queryArgs.join(',') |             this._textFilter = textQueryArgs.join(',') | ||||||
|             this.textFilterTarget = TEXT_FILTER_TARGET_FULLTEXT_QUERY |             this.textFilterTarget = TEXT_FILTER_TARGET_FULLTEXT_QUERY | ||||||
|           } |           } | ||||||
|           break |           break | ||||||
| @@ -533,9 +533,24 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | |||||||
|       this.dateCreatedRelativeDate !== null |       this.dateCreatedRelativeDate !== null | ||||||
|     ) { |     ) { | ||||||
|       let queryArgs: Array<string> = [] |       let queryArgs: Array<string> = [] | ||||||
|       const existingRule = filterRules.find( |       let existingRule = filterRules.find( | ||||||
|         (fr) => fr.rule_type == FILTER_FULLTEXT_QUERY |         (fr) => fr.rule_type == FILTER_FULLTEXT_QUERY | ||||||
|       ) |       ) | ||||||
|  |  | ||||||
|  |       // if had a title / content search and added a relative date we need to carry it over... | ||||||
|  |       if ( | ||||||
|  |         !existingRule && | ||||||
|  |         this._textFilter?.length > 0 && | ||||||
|  |         (this.textFilterTarget == TEXT_FILTER_TARGET_TITLE_CONTENT || | ||||||
|  |           this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) | ||||||
|  |       ) { | ||||||
|  |         existingRule = filterRules.find( | ||||||
|  |           (fr) => | ||||||
|  |             fr.rule_type == FILTER_TITLE_CONTENT || fr.rule_type == FILTER_TITLE | ||||||
|  |         ) | ||||||
|  |         existingRule.rule_type = FILTER_FULLTEXT_QUERY | ||||||
|  |       } | ||||||
|  |  | ||||||
|       let existingRuleArgs = existingRule?.value.split(',') |       let existingRuleArgs = existingRule?.value.split(',') | ||||||
|       if (this.dateCreatedRelativeDate !== null) { |       if (this.dateCreatedRelativeDate !== null) { | ||||||
|         queryArgs.push( |         queryArgs.push( | ||||||
|   | |||||||
| @@ -372,6 +372,10 @@ textarea, | |||||||
|   &:hover, &:focus { |   &:hover, &:focus { | ||||||
|     background-color: var(--bs-body-bg); |     background-color: var(--bs-body-bg); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   &:focus { | ||||||
|  |     color: var(--bs-body-color); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| .dropdown-menu { | .dropdown-menu { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon