A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Merge branch 'dev' into feature-permissions
shamoond2a6f7961297
diff --cc src/documents/index.pyindex 5adbcc5b6,e11708f45..c0b3f5465--- a/src/documents/index.py+++ b/src/documents/index.py@@@ -5,9 -5,9 +5,10 @@@ from contextlib import contextmanagefrom dateutil.parser import isoparsefrom django.conf import settings+ from django.utils import timezonefrom documents.models import Commentfrom documents.models import Document+from guardian.shortcuts import get_users_with_permsfrom whoosh import classifyfrom whoosh import highlightfrom whoosh import query@@@ -98,11 -94,18 +99,23 @@@ def update_document(writer: AsyncWritertags = ",".join([t.name for t in doc.tags.all()])tags_ids = ",".join([str(t.id) for t in doc.tags.all()])comments = ",".join([str(c.comment) for c in Comment.objects.filter(document=doc)])+ asn = doc.archive_serial_number+ if asn is not None and (+ asn < Document.ARCHIVE_SERIAL_NUMBER_MIN+ or asn > Document.ARCHIVE_SERIAL_NUMBER_MAX+ ):+ logger.error(+ f"Not indexing Archive Serial Number {asn} of document {doc.pk}. "+ f"ASN is out of range "+ f"[{Document.ARCHIVE_SERIAL_NUMBER_MIN:,}, "+ f"{Document.ARCHIVE_SERIAL_NUMBER_MAX:,}.",+ )+ asn = 0+ users_with_perms = get_users_with_perms(+ doc,+ only_with_perms_in=["view_document"],+ )+ viewer_ids = ",".join([str(u.id) for u in users_with_perms])writer.update_document(id=doc.pk,title=doc.title,