Skip to content

Commit

Permalink
Only index on canvas save, not ocr annotation save
Browse files Browse the repository at this point in the history
ref #944
  • Loading branch information
blms committed Nov 10, 2023
1 parent e262ad5 commit 8b13757
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions apps/iiif/canvases/management/commands/rebuild_ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@ def __rebuild(self, canvas, testing=False):
anno.content = word['content']
anno.save()
prog_bar.next()
canvas.save()
prog_bar.finish()
1 change: 1 addition & 0 deletions apps/iiif/canvases/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def add_ocr_task(canvas_id, *args, **kwargs):

if ocr is not None:
add_ocr_annotations(canvas, ocr)
canvas.save() # trigger reindex

@app.task(name='adding_oa_ocr_to_canvas', retry_backoff=5)
def add_oa_ocr_task(annotation_list_url):
Expand Down
5 changes: 1 addition & 4 deletions apps/iiif/manifests/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Django:
"publisher",
"viewingdirection",
]
related_models = [Collection, Canvas, Annotation]
related_models = [Collection, Canvas]

def prepare_authors(self, instance):
"""convert authors string into list"""
Expand Down Expand Up @@ -125,6 +125,3 @@ def get_instances_from_related(self, related_instance):
elif isinstance(related_instance, Canvas):
# many to many relationship
return related_instance.manifest
elif isinstance(related_instance, Annotation):
# many to many relationship
return related_instance.canvas.manifest

0 comments on commit 8b13757

Please sign in to comment.