Repository: paperless-ngx/paperless-ngx

Issue:
[BUG] Selecting date ranges breaks searches
### Description

Searching documents using TWO filters will not work, if one parameter is "last month" or "last year" in the "added" or "created" field. I tried to be more precise than #3203 

Example: 

Selected document type is "Anleitung" -> everything works as expected:
![image](https://user-images.githubusercontent.com/113503248/234883356-1975b4b6-713c-4d93-bb52-459638fa2ed4.png)

Now a second filter "last year" is applied. Year is as expected but selected document type is ignored:
![image](https://user-images.githubusercontent.com/113503248/234883815-39dcd974-a010-46ac-9897-cb326cf036cc.png)


### Steps to reproduce

1. login as a superuser
2. go to web-ui -> documents
3. reset filters (all documents displayed now)
4. select document type.
5. select "created" oder "added" date range "last year"
-> all document types ara displayed.

### Webserver logs

```bash
none
```


### Browser logs

```bash
none
```


### Paperless-ngx version

1.14.0

### Host OS

Linux 3.10.108 #42661 SMP (x86_64)

### Installation method

Docker - official image

### Browser

Chrome

### Configuration changes

_No response_

### Other

_No response_


Discussion:
Thanks, yep got it

Resolving patch:
diff --git a/src/documents/index.py b/src/documents/index.py
--- a/src/documents/index.py
+++ b/src/documents/index.py
@@ -172,6 +172,14 @@ def _get_query_filter(self):
         for k, v in self.query_params.items():
             if k == "correspondent__id":
                 criterias.append(query.Term("correspondent_id", v))
+            elif k == "correspondent__id__in":
+                for correspondent_id in v.split(","):
+                    criterias.append(query.Term("correspondent_id", correspondent_id))
+            elif k == "correspondent__id__none":
+                for correspondent_id in v.split(","):
+                    criterias.append(
+                        query.Not(query.Term("correspondent_id", correspondent_id)),
+                    )
             elif k == "tags__id__all":
                 for tag_id in v.split(","):
                     criterias.append(query.Term("tag_id", tag_id))
@@ -180,6 +188,12 @@ def _get_query_filter(self):
                     criterias.append(query.Not(query.Term("tag_id", tag_id)))
             elif k == "document_type__id":
                 criterias.append(query.Term("type_id", v))
+            elif k == "document_type__id__in":
+                for document_type_id in v.split(","):
+                    criterias.append(query.Term("type_id", document_type_id))
+            elif k == "document_type__id__none":
+                for document_type_id in v.split(","):
+                    criterias.append(query.Not(query.Term("type_id", document_type_id)))
             elif k == "correspondent__isnull":
                 criterias.append(query.Term("has_correspondent", v == "false"))
             elif k == "is_tagged":
@@ -200,6 +214,12 @@ def _get_query_filter(self):
                 criterias.append(query.DateRange("added", start=None, end=isoparse(v)))
             elif k == "storage_path__id":
                 criterias.append(query.Term("path_id", v))
+            elif k == "storage_path__id__in":
+                for storage_path_id in v.split(","):
+                    criterias.append(query.Term("path_id", storage_path_id))
+            elif k == "storage_path__id__none":
+                for storage_path_id in v.split(","):
+                    criterias.append(query.Not(query.Term("path_id", storage_path_id)))
             elif k == "storage_path__isnull":
                 criterias.append(query.Term("has_path", v == "false"))
 


Test patch:
diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py
--- a/src/documents/tests/test_api.py
+++ b/src/documents/tests/test_api.py
@@ -955,8 +955,32 @@ def search_query(q):
             [d1.id, d2.id, d5.id, d7.id],
         )
         self.assertCountEqual(search_query("&correspondent__id=" + str(c.id)), [d1.id])
+        self.assertCountEqual(
+            search_query("&correspondent__id__in=" + str(c.id)),
+            [d1.id],
+        )
+        self.assertCountEqual(
+            search_query("&correspondent__id__none=" + str(c.id)),
+            [d2.id, d3.id, d4.id, d5.id, d7.id],
+        )
         self.assertCountEqual(search_query("&document_type__id=" + str(dt.id)), [d2.id])
+        self.assertCountEqual(
+            search_query("&document_type__id__in=" + str(dt.id)),
+            [d2.id],
+        )
+        self.assertCountEqual(
+            search_query("&document_type__id__none=" + str(dt.id)),
+            [d1.id, d3.id, d4.id, d5.id, d7.id],
+        )
         self.assertCountEqual(search_query("&storage_path__id=" + str(sp.id)), [d7.id])
+        self.assertCountEqual(
+            search_query("&storage_path__id__in=" + str(sp.id)),
+            [d7.id],
+        )
+        self.assertCountEqual(
+            search_query("&storage_path__id__none=" + str(sp.id)),
+            [d1.id, d2.id, d3.id, d4.id, d5.id],
+        )
 
         self.assertCountEqual(
             search_query("&storage_path__isnull"),