mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Fix: correct all results with whoosh queries (#9331)
This commit is contained in:
parent
5f16d5f5f1
commit
b4b0f802e1
@ -32,6 +32,7 @@ from rest_framework.permissions import IsAuthenticated
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.viewsets import ModelViewSet
|
from rest_framework.viewsets import ModelViewSet
|
||||||
|
|
||||||
|
from documents.index import DelayedQuery
|
||||||
from documents.permissions import PaperlessObjectPermissions
|
from documents.permissions import PaperlessObjectPermissions
|
||||||
from paperless.filters import GroupFilterSet
|
from paperless.filters import GroupFilterSet
|
||||||
from paperless.filters import UserFilterSet
|
from paperless.filters import UserFilterSet
|
||||||
@ -66,17 +67,17 @@ class StandardPagination(PageNumberPagination):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_all_result_ids(self):
|
def get_all_result_ids(self):
|
||||||
ids = []
|
query = self.page.paginator.object_list
|
||||||
if hasattr(self.page.paginator.object_list, "saved_results"):
|
if isinstance(query, DelayedQuery):
|
||||||
results_page = self.page.paginator.object_list.saved_results[0]
|
try:
|
||||||
if results_page is not None:
|
ids = [
|
||||||
for i in range(len(results_page.results.docs())):
|
query.searcher.ixreader.stored_fields(
|
||||||
try:
|
doc_num,
|
||||||
fields = results_page.results.fields(i)
|
)["id"]
|
||||||
if "id" in fields:
|
for doc_num in query.saved_results.get(0).results.docs()
|
||||||
ids.append(fields["id"])
|
]
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
ids = self.page.paginator.object_list.values_list("pk", flat=True)
|
ids = self.page.paginator.object_list.values_list("pk", flat=True)
|
||||||
return ids
|
return ids
|
||||||
|
Loading…
x
Reference in New Issue
Block a user