mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-16 00:36:22 +00:00
Handcrafts SQL queries a little more to reduce the query count and/or the amount of returned data (#6489)
This commit is contained in:
@@ -155,8 +155,12 @@ class DocumentClassifier:
|
||||
|
||||
def train(self):
|
||||
# Get non-inbox documents
|
||||
docs_queryset = Document.objects.exclude(
|
||||
tags__is_inbox_tag=True,
|
||||
docs_queryset = (
|
||||
Document.objects.exclude(
|
||||
tags__is_inbox_tag=True,
|
||||
)
|
||||
.select_related("document_type", "correspondent", "storage_path")
|
||||
.prefetch_related("tags")
|
||||
)
|
||||
|
||||
# No documents exit to train against
|
||||
|
Reference in New Issue
Block a user