mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-19 21:16:56 +01: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:
parent
63e1f9f5d3
commit
7be7185418
10 changed files with 188 additions and 135 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue