mirror of
				https://codeberg.org/SeedDMS/paperless
				synced 2025-10-31 05:11:22 +00:00 
			
		
		
		
	support combinded search with date and query string
This commit is contained in:
		
							parent
							
								
									5c3eb35aec
								
							
						
					
					
						commit
						f0c66b737f
					
				|  | @ -399,24 +399,27 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */ | ||||||
| 		if($fullsearch) { | 		if($fullsearch) { | ||||||
| //			print_r($params);
 | //			print_r($params);
 | ||||||
| 			if (isset($params["query"]) && is_string($params["query"])) { | 			if (isset($params["query"]) && is_string($params["query"])) { | ||||||
| 				if(substr($params["query"], 0, 7) == 'added:[') { | 				$queryparts = explode(',', $params["query"]); | ||||||
| 					$q = substr($params["query"], 7, -1); | 				foreach($queryparts as $querypart) { | ||||||
| 					if($t = explode(' to ', $q, 2)) { | 					if(substr($querypart, 0, 7) == 'added:[') { | ||||||
| 						$astart = strtotime($t[0]); | 						$q = substr($querypart, 7, -1); | ||||||
| 						$aend = strtotime($t[1])+86400; | 						if($t = explode(' to ', $q, 2)) { | ||||||
| //						echo "astart: ".date('Y-m-d', $astart)."\n";
 | 							$astart = strtotime($t[0]); | ||||||
| //						echo "aend: ".date('Y-m-d', $aend);
 | 							$aend = strtotime($t[1])+86400; | ||||||
| 					} | 	//						echo "astart: ".date('Y-m-d', $astart)."\n";
 | ||||||
| 				} elseif(substr($params["query"], 0, 9) == 'created:[') { | 	//						echo "aend: ".date('Y-m-d', $aend);
 | ||||||
| 					$q = substr($params["query"], 9, -1); | 						} | ||||||
| 					if($t = explode(' to ', $q, 2)) { | 					} elseif(substr($querypart, 0, 9) == 'created:[') { | ||||||
| 						$astart = strtotime($t[0]); | 						$q = substr($querypart, 9, -1); | ||||||
| 						$aend = strtotime($t[1])+86400; | 						if($t = explode(' to ', $q, 2)) { | ||||||
| //						echo "astart: ".date('Y-m-d', $astart)."\n";
 | 							$astart = strtotime($t[0]); | ||||||
| //						echo "aend: ".date('Y-m-d', $aend);
 | 							$aend = strtotime($t[1])+86400; | ||||||
| 					} | 	//						echo "astart: ".date('Y-m-d', $astart)."\n";
 | ||||||
| 				} else | 	//						echo "aend: ".date('Y-m-d', $aend);
 | ||||||
| 					$query = $params["query"]; | 						} | ||||||
|  | 					} else | ||||||
|  | 						$query = $querypart; | ||||||
|  | 				} | ||||||
| 			} elseif (isset($params["title_content"]) && is_string($params["title_content"])) { | 			} elseif (isset($params["title_content"]) && is_string($params["title_content"])) { | ||||||
| 				$query = $params['title_content']; | 				$query = $params['title_content']; | ||||||
| 			} elseif (isset($params["title__icontains"]) && is_string($params["title__icontains"])) { | 			} elseif (isset($params["title__icontains"]) && is_string($params["title__icontains"])) { | ||||||
|  | @ -496,10 +499,10 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */ | ||||||
| 					$facets = $searchresult['facets']; | 					$facets = $searchresult['facets']; | ||||||
| 					$dcount = 0; | 					$dcount = 0; | ||||||
| 					$fcount = 0; | 					$fcount = 0; | ||||||
| 					if($searchresult) { | 					if($searchresult['hits']) { | ||||||
| 						foreach($searchresult['hits'] as $hit) { | 						foreach($searchresult['hits'] as $hit) { | ||||||
| 							if($hit['document_id'][0] == 'D') { | 							if($hit['document_id'][0] == 'D') { | ||||||
| 								if($tmp = $dms->getDocument(substr($hit['document_id'], 1))) { | 								if($tmp = $dms->getDocument((int) substr($hit['document_id'], 1))) { | ||||||
| 	//								if($tmp->getAccessMode($user) >= M_READ) {
 | 	//								if($tmp->getAccessMode($user) >= M_READ) {
 | ||||||
| 										$tmp->verifyLastestContentExpriry(); | 										$tmp->verifyLastestContentExpriry(); | ||||||
| 										$recs[] = $this->__getDocumentData($tmp); | 										$recs[] = $this->__getDocumentData($tmp); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann