Hi,
I want to find all documents having no ocr content or no document content.
If I use the model attributes document.content / document.ocr_content to check if they are empty, the problem is how to use the these contents as they are generator objects.
How can these objects be used within conditions for checking?
Regards,
Johann
Hi,
We tried adding a way to search for empty values that would work regardless of the search backend. The deadline for version 4.4 closed and we could not fit this in. For now you can do this using Indexes.
This template would mark documents with no parsed content:
{% if not document.content|join:'' %}{{ document.label }}{% endif %}
This template will mark documents with no OCR content:
{% if not document.ocr_content|join:'' %}{{ document.label }}{% endif %}
This same logic would work for conditions:
{% if not document.ocr_content|join:'' %}True{% endif %}
Hi,
thank you very much for the quick response and solution! Works nice.
I was almost there by myself - I just missed the right use of the join filter in this context.
Regards,
Johann
1 Like