A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: correct all results with whoosh queries (#9331)
shamoonb4b0f802e153
diff --git a/src/paperless/views.py b/src/paperless/views.pyindex fdd7c21a4..050bb3f61 100644--- a/src/paperless/views.py+++ b/src/paperless/views.py@@ -32,6 +32,7 @@ from rest_framework.permissions import IsAuthenticatedfrom rest_framework.response import Responsefrom rest_framework.viewsets import ModelViewSet+from documents.index import DelayedQueryfrom documents.permissions import PaperlessObjectPermissionsfrom paperless.filters import GroupFilterSetfrom paperless.filters import UserFilterSet@@ -66,17 +67,17 @@ class StandardPagination(PageNumberPagination):)def get_all_result_ids(self):- ids = []- if hasattr(self.page.paginator.object_list, "saved_results"):- results_page = self.page.paginator.object_list.saved_results[0]- if results_page is not None:- for i in range(len(results_page.results.docs())):- try:- fields = results_page.results.fields(i)- if "id" in fields:- ids.append(fields["id"])- except Exception:- pass+ query = self.page.paginator.object_list+ if isinstance(query, DelayedQuery):+ try:+ ids = [+ query.searcher.ixreader.stored_fields(+ doc_num,+ )["id"]+ for doc_num in query.saved_results.get(0).results.docs()+ ]+ except Exception:+ passelse:ids = self.page.paginator.object_list.values_list("pk", flat=True)return ids