oarepo-runtime 1.7.1__py3-none-any.whl → 1.7.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,17 +9,16 @@ from invenio_records_resources.services.custom_fields.mappings import (
9
9
  )
10
10
  from invenio_records_resources.services.records.config import RecordServiceConfig
11
11
  from invenio_records_resources.services.records.service import RecordService
12
- from invenio_search import current_search_client
13
- from invenio_search.engine import dsl, search
14
- from invenio_search.utils import build_alias_name
15
-
12
+ from invenio_search.engine import search
16
13
  from deepmerge import always_merger
17
14
  from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
18
15
  import json
19
- import os
20
16
 
21
17
  from pathlib import Path
22
18
 
19
+ from oarepo_runtime.utils.index import prefixed_index
20
+
21
+
23
22
  class Mapping(InvenioMapping):
24
23
  @classmethod
25
24
  def properties_for_fields(
@@ -95,21 +94,11 @@ def prepare_cf_index(record_class, config, path=[]):
95
94
 
96
95
  # upload mapping
97
96
  try:
98
- record_index = dsl.Index(
99
- build_alias_name(
100
- config.record_cls.index._name,
101
- ),
102
- using=current_search_client,
103
- )
97
+ record_index = prefixed_index(config.record_cls.index)
104
98
  update_index(record_index, settings, mapping)
105
99
 
106
100
  if hasattr(config, "draft_cls"):
107
- draft_index = dsl.Index(
108
- build_alias_name(
109
- config.draft_cls.index._name,
110
- ),
111
- using=current_search_client,
112
- )
101
+ draft_index = prefixed_index(config.draft_cls.index)
113
102
  update_index(draft_index, settings, mapping, dynamic_templates)
114
103
 
115
104
  except search.RequestError as e:
@@ -166,22 +155,12 @@ def prepare_parent_mapping(parent_class, config):
166
155
  })
167
156
  # upload mapping
168
157
  try:
169
- record_index = dsl.Index(
170
- build_alias_name(
171
- config.record_cls.index._name,
172
- ),
173
- using=current_search_client,
174
- )
158
+ record_index = prefixed_index(config.record_cls.index)
175
159
  update_index(record_index, {}, parent_mapping_merged)
176
160
 
177
161
  if hasattr(config, "draft_cls"):
178
- draft_index = dsl.Index(
179
- build_alias_name(
180
- config.draft_cls.index._name,
181
- ),
182
- using=current_search_client,
183
- )
184
- update_index(record_index, {}, parent_mapping_merged)
162
+ draft_index = prefixed_index(config.draft_cls.index) # draft index isn't used; this was a bug a suppose
163
+ update_index(draft_index, {}, parent_mapping_merged)
185
164
 
186
165
  except search.RequestError as e:
187
166
  click.secho("An error occurred while creating parent mapping.", fg="red")
@@ -0,0 +1,11 @@
1
+ from invenio_search import current_search_client
2
+ from invenio_search.utils import build_alias_name
3
+ from invenio_search.engine import dsl
4
+
5
+ def prefixed_index(index):
6
+ return dsl.Index(
7
+ build_alias_name(
8
+ index._name,
9
+ ),
10
+ using = current_search_client
11
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oarepo-runtime
3
- Version: 1.7.1
3
+ Version: 1.7.2
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -98,7 +98,7 @@ oarepo_runtime/services/config/link_conditions.py,sha256=5hDEtCaQt1tzjb9gGdeimsm
98
98
  oarepo_runtime/services/config/permissions_presets.py,sha256=b1wm3JjL8KgkaH7VMkNfdMk5fXtf3X87rB7gkvaNxns,7369
99
99
  oarepo_runtime/services/config/service.py,sha256=KS1eKXjRzusD_UAKanzKezua2lmo9vObwqd63dky1ik,4593
100
100
  oarepo_runtime/services/custom_fields/__init__.py,sha256=_gqMcA_I3rdEZcBtCuDjO4wdVCqFML5NzaccuPx5a3o,2565
101
- oarepo_runtime/services/custom_fields/mappings.py,sha256=3CIvjWzVRO3fZ2r-3taK1rwuLH9wj5Lguo-GvsbLBf4,7515
101
+ oarepo_runtime/services/custom_fields/mappings.py,sha256=U43noOuANohgoZt7YoAT3B6NgDCLKIRVKigPHzsreQU,6970
102
102
  oarepo_runtime/services/entity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
103
  oarepo_runtime/services/entity/config.py,sha256=1jfdPrxSbMuKj7eOUNKRWTCPbBPyRV6MrWE4Vgf9rX0,399
104
104
  oarepo_runtime/services/entity/schema.py,sha256=8TBpUFRITaBO7qCMz36cly1Hj4I1nLa9PeSAfWSa2YM,157
@@ -148,14 +148,15 @@ oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=tq5pTCpH7cuzdwrQlp
148
148
  oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=7-5S3iINOSFSI5gVdRvT5S2rbGScrheJiUJQH_fqXmY,1914
149
149
  oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
151
+ oarepo_runtime/utils/index.py,sha256=ArrUUXB-KowUcUksRKqcFpmqct4bn9alO1zd_kX2tmU,292
151
152
  oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
152
- oarepo_runtime-1.7.1.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
153
+ oarepo_runtime-1.7.2.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
153
154
  tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
155
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
155
156
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
156
157
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
- oarepo_runtime-1.7.1.dist-info/METADATA,sha256=rvL7MLlWJ21OM6vVVDks-Ga6iqUJiqmqEZirtr1OfbA,4788
158
- oarepo_runtime-1.7.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
159
- oarepo_runtime-1.7.1.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
160
- oarepo_runtime-1.7.1.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
161
- oarepo_runtime-1.7.1.dist-info/RECORD,,
158
+ oarepo_runtime-1.7.2.dist-info/METADATA,sha256=zgNr97N1sEuZ23n7YI99fqBLKHIRKdQdxwp9vS9DtLo,4788
159
+ oarepo_runtime-1.7.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
160
+ oarepo_runtime-1.7.2.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
161
+ oarepo_runtime-1.7.2.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
162
+ oarepo_runtime-1.7.2.dist-info/RECORD,,