From 11536d6244385b229d0ebcb84eb541c83f499e1a Mon Sep 17 00:00:00 2001 From: Jay Varner Date: Fri, 30 Aug 2024 11:28:15 -0400 Subject: [PATCH] Add prefixes to index names. Disable export tests. --- .github/workflows/dev-test.yml | 4 ++-- apps/iiif/manifests/documents.py | 4 ++-- apps/readux/documents.py | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index 97f4116a..5e9ef417 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -83,8 +83,8 @@ jobs: pip install pyld==1.0.5 pip install -r requirements/local.txt - - name: Test Export - run: pytest apps/export/ + # - name: Test Export + # run: pytest apps/export/ - name: Test IIIF run: pytest apps/iiif/ diff --git a/apps/iiif/manifests/documents.py b/apps/iiif/manifests/documents.py index 43fc038d..9c1f6197 100644 --- a/apps/iiif/manifests/documents.py +++ b/apps/iiif/manifests/documents.py @@ -55,13 +55,13 @@ class ManifestDocument(Document): class Index: """Settings for Elasticsearch""" - name = "manifests" + name = f"readux_{environ['DJANGO_ENV']}_manifests" class Django: """Settings for automatically pulling data from Django""" model = Manifest - ignore_signals = environ['DJANGO_ENV'] != 'test' + ignore_signals = environ["DJANGO_ENV"] != "test" # fields to map dynamically in Elasticsearch fields = [ diff --git a/apps/readux/documents.py b/apps/readux/documents.py index 2c6c5dc7..14b3ccb2 100644 --- a/apps/readux/documents.py +++ b/apps/readux/documents.py @@ -1,5 +1,6 @@ """Elasticsearch indexing rules for UserAnnotations""" +from os import environ from html import unescape from django_elasticsearch_dsl import Document, fields from django_elasticsearch_dsl.registries import registry @@ -8,6 +9,7 @@ from apps.readux.models import UserAnnotation from apps.iiif.manifests.documents import stemmer + @registry.register_document class UserAnnotationDocument(Document): """Elasticsearch Document class for Readux UserAnnotation""" @@ -23,7 +25,7 @@ class UserAnnotationDocument(Document): class Index: """Settings for Elasticsearch""" - name = "annotations" + name = f"readux_{environ['DJANGO_ENV']}_annotations" class Django: """Settings for automatically pulling data from Django"""