oarepo-runtime 1.7.2__tar.gz → 1.9.0__tar.gz
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.
- {oarepo_runtime-1.7.2/oarepo_runtime.egg-info → oarepo_runtime-1.9.0}/PKG-INFO +1 -1
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/types.py +6 -6
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/__init__.py +18 -2
- oarepo_runtime-1.9.0/oarepo_runtime/records/systemfields/icu.py +371 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/mapping.py +2 -4
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0/oarepo_runtime.egg-info}/PKG-INFO +1 -1
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/setup.cfg +1 -1
- oarepo_runtime-1.7.2/oarepo_runtime/records/systemfields/icu.py +0 -214
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/LICENSE +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/MANIFEST.in +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/README.md +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/assets.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/base.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/cf.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/check.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/configuration.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/fixtures.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/index.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/permissions/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/permissions/base.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/permissions/evaluate.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/permissions/list.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/permissions/search.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/cli/validate.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/config.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/asynchronous.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/catalogue.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/datastreams.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/errors.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/ext.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/fixtures.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/json.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/readers/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/readers/attachments.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/readers/excel.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/readers/json.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/readers/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/readers/yaml.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/semi_asynchronous.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/synchronous.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/transformers.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/utils.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/attachments_file.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/attachments_service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/publish.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/utils.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/validation_errors.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/datastreams/writers/yaml.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/ext.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/ext_config.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/i18n/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/info/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/info/check.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/info/permissions/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/info/permissions/debug.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/info/views.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/profile.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/proxies.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/drafts.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/dumpers/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/dumpers/edtf_interval.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/dumpers/multilingual_dumper.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/entity_resolvers/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/entity_resolvers/proxies.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/mappings/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/mappings/rdm_parent_mapping.json +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/owners/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/owners/registry.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/pid_providers.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/relations/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/relations/base.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/relations/internal.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/relations/lookup.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/relations/pid_relation.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/featured_file.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/has_draftcheck.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/owner.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/record_status.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/selectors.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/synthetic.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/config.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/file_resource.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/json_serializer.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/localized_ui_json_serializer.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/resource.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/resources/responses.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/components.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/config/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/config/draft_link.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/config/link_conditions.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/config/permissions_presets.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/config/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/custom_fields/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/custom_fields/mappings.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/entity/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/entity/config.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/entity/schema.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/entity/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/expansions/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/expansions/expandable_fields.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/expansions/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/base.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/date.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/enum.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/facet_groups_names.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/max_facet.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/multilingual_facet.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/nested_facet.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/params.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/facets/year_histogram.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/files/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/files/components.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/files/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/generators.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/permissions/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/permissions/generators.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/records/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/records/links.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/relations/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/relations/components.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/relations/errors.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/relations/mapping.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/results.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/cf.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/i18n.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/i18n_ui.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/i18n_validation.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/marshmallow.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/marshmallow_to_json_schema.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/oneofschema.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/polymorphic.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/rdm.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/rdm_ui.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/ui.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/schema/validation.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/search.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/services/service.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/tasks.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/translations/default_translations.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/translations/en/LC_MESSAGES/messages.mo +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/translations/en/LC_MESSAGES/messages.po +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/translations/messages.pot +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/uow.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/utils/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/utils/functools.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/utils/index.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/utils/path.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime.egg-info/SOURCES.txt +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime.egg-info/dependency_links.txt +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime.egg-info/entry_points.txt +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime.egg-info/requires.txt +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime.egg-info/top_level.txt +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/pyproject.toml +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/setup.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/tests/marshmallow_to_json/__init__.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/tests/marshmallow_to_json/test_datacite_ui_schema.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/tests/marshmallow_to_json/test_simple_schema.py +0 -0
- {oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/tests/pkg_data/__init__.py +0 -0
@@ -155,11 +155,11 @@ class StreamEntry:
|
|
155
155
|
def __str__(self):
|
156
156
|
ret = [
|
157
157
|
f"Entry #{self.seq}: id {self.id or 'not yet set'}, filtered: {self.filtered}, deleted: {self.deleted}",
|
158
|
-
|
158
|
+
"Content:",
|
159
159
|
textwrap.indent(
|
160
160
|
json.dumps(self.entry, ensure_ascii=False, indent=4), " "
|
161
161
|
),
|
162
|
-
|
162
|
+
"Context:",
|
163
163
|
textwrap.indent(
|
164
164
|
json.dumps(self.context, ensure_ascii=False, indent=4), " "
|
165
165
|
),
|
@@ -238,14 +238,14 @@ class DataStreamCallback:
|
|
238
238
|
def batch_started(self, batch):
|
239
239
|
log.info("Batch started: %s", batch)
|
240
240
|
|
241
|
-
def batch_finished(self, batch):
|
242
|
-
log.info("Batch finished: %s", batch)
|
241
|
+
def batch_finished(self, batch: StreamBatch):
|
242
|
+
log.info("Batch finished: %s", batch.seq)
|
243
243
|
for err in batch.errors:
|
244
|
-
log.error("Failed batch: %s: %s", err, batch)
|
244
|
+
log.error("Failed batch: %s: %s", err, batch.seq)
|
245
245
|
if self.log_error_entry:
|
246
246
|
for entry in batch.entries:
|
247
247
|
if entry.errors:
|
248
|
-
log.error("Failed entry: %s", entry)
|
248
|
+
log.error("Failed entry: %s in batch %s", entry, batch.seq)
|
249
249
|
|
250
250
|
def reader_error(self, reader, exception):
|
251
251
|
log.error("Reader error: %s: %s", reader, exception)
|
{oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/__init__.py
RENAMED
@@ -1,12 +1,27 @@
|
|
1
|
-
from .icu import
|
1
|
+
from .icu import (
|
2
|
+
FulltextIndexField,
|
3
|
+
ICUField,
|
4
|
+
ICUSearchField,
|
5
|
+
ICUSortField,
|
6
|
+
ICUSuggestField,
|
7
|
+
TermIndexField,
|
8
|
+
)
|
2
9
|
from .mapping import MappingSystemFieldMixin, SystemFieldDumperExt
|
3
|
-
from .selectors import
|
10
|
+
from .selectors import (
|
11
|
+
FilteredSelector,
|
12
|
+
FirstItemSelector,
|
13
|
+
MultiSelector,
|
14
|
+
PathSelector,
|
15
|
+
Selector,
|
16
|
+
)
|
4
17
|
from .synthetic import SyntheticSystemField
|
5
18
|
|
6
19
|
__all__ = (
|
7
20
|
"ICUField",
|
8
21
|
"ICUSuggestField",
|
9
22
|
"ICUSortField",
|
23
|
+
"ICUSearchField",
|
24
|
+
"FulltextIndexField",
|
10
25
|
"MappingSystemFieldMixin",
|
11
26
|
"SystemFieldDumperExt",
|
12
27
|
"SyntheticSystemField",
|
@@ -15,4 +30,5 @@ __all__ = (
|
|
15
30
|
"FirstItemSelector",
|
16
31
|
"FilteredSelector",
|
17
32
|
"MultiSelector",
|
33
|
+
"TermIndexField",
|
18
34
|
)
|
@@ -0,0 +1,371 @@
|
|
1
|
+
from abc import abstractmethod, abstractproperty
|
2
|
+
from functools import cached_property
|
3
|
+
from typing import Dict
|
4
|
+
|
5
|
+
from flask import current_app
|
6
|
+
from invenio_records.systemfields import SystemField
|
7
|
+
|
8
|
+
from oarepo_runtime.records.relations.lookup import lookup_key
|
9
|
+
from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
|
10
|
+
|
11
|
+
|
12
|
+
class ICUBase(MappingSystemFieldMixin, SystemField):
|
13
|
+
"""
|
14
|
+
Base class for ICU system fields.
|
15
|
+
It provides the basic functionality for ICU fields, such as
|
16
|
+
getting the attribute name and handling the key.
|
17
|
+
"""
|
18
|
+
|
19
|
+
def __init__(self, source_field=None, key=None):
|
20
|
+
super().__init__(key=key)
|
21
|
+
self._attr_name = key or self.__class__.__name__.lower()
|
22
|
+
self.source_field = source_field
|
23
|
+
|
24
|
+
@cached_property
|
25
|
+
def languages(self) -> Dict[str, Dict]:
|
26
|
+
icu_languages = current_app.config.get("OAREPO_ICU_LANGUAGES", {})
|
27
|
+
if icu_languages:
|
28
|
+
return icu_languages
|
29
|
+
|
30
|
+
primary_language = current_app.config.get("BABEL_DEFAULT_LOCALE", "en")
|
31
|
+
# list of tuples [lang, title], just take lang
|
32
|
+
babel_languages = [x[0] for x in current_app.config.get("I18N_LANGUAGES", [])]
|
33
|
+
|
34
|
+
return {primary_language: {}, **{k: {} for k in babel_languages}}
|
35
|
+
|
36
|
+
def get_values(self, data, language):
|
37
|
+
ret = []
|
38
|
+
for l in lookup_key(data, f"{self.source_field}"):
|
39
|
+
if isinstance(l.value, str):
|
40
|
+
# take single value as being always the the language provided
|
41
|
+
ret.append(l.value)
|
42
|
+
elif isinstance(l.value, dict):
|
43
|
+
# expected to be {"cs": "", "en": ""}
|
44
|
+
val = l.value.get(language)
|
45
|
+
if val:
|
46
|
+
ret.append(val)
|
47
|
+
elif "lang" in l.value:
|
48
|
+
# for [{"lang": "", "value": ""}, ...] we get each item separately
|
49
|
+
# that's why we do not iterate over l.value
|
50
|
+
if l.value["lang"] == language:
|
51
|
+
ret.append(l.value["value"])
|
52
|
+
return ret
|
53
|
+
|
54
|
+
@abstractproperty
|
55
|
+
def mapping(self):
|
56
|
+
"""
|
57
|
+
The mapping for the field. It should return a dictionary with the
|
58
|
+
mapping for the field, based on the current configuration of the application.
|
59
|
+
"""
|
60
|
+
raise NotImplementedError("Subclasses must implement the mapping property.")
|
61
|
+
|
62
|
+
@abstractmethod
|
63
|
+
def search_dump(self, data, record):
|
64
|
+
"""
|
65
|
+
Dump custom field. This method should be implemented by subclasses
|
66
|
+
to provide the functionality for dumping the field data into the
|
67
|
+
OpenSearch data structure.
|
68
|
+
"""
|
69
|
+
raise NotImplementedError("Subclasses must implement the search_dump method.")
|
70
|
+
|
71
|
+
def search_load(self, data, record_cls):
|
72
|
+
"""
|
73
|
+
Just remove the field from the data on load.
|
74
|
+
"""
|
75
|
+
data.pop(self.attr_name, None)
|
76
|
+
|
77
|
+
def __get__(self, instance, owner):
|
78
|
+
return self
|
79
|
+
|
80
|
+
|
81
|
+
class ICUField(ICUBase):
|
82
|
+
"""
|
83
|
+
A system field that acts as an opensearch "proxy" to another field.
|
84
|
+
It creates a top-level mapping field with the same name and copies
|
85
|
+
content of {another field}.language into {mapping field}.language.
|
86
|
+
|
87
|
+
The language accessor can be modified by overriding get_values method.
|
88
|
+
"""
|
89
|
+
|
90
|
+
def __init__(self, *, source_field, key=None):
|
91
|
+
super().__init__(source_field=source_field, key=key)
|
92
|
+
|
93
|
+
def search_dump(self, data, record):
|
94
|
+
ret = {}
|
95
|
+
for lang in self.languages:
|
96
|
+
r = self.get_values(data, lang)
|
97
|
+
if r:
|
98
|
+
# if the language is not empty, add it to the result
|
99
|
+
# otherwise do not add it at all to safe transport
|
100
|
+
ret[lang] = r
|
101
|
+
if ret:
|
102
|
+
data[self.attr_name] = ret
|
103
|
+
|
104
|
+
|
105
|
+
class ICUSortField(ICUField):
|
106
|
+
"""
|
107
|
+
A field that adds icu sorting field
|
108
|
+
"""
|
109
|
+
|
110
|
+
def __init__(self, *, source_field, key=None):
|
111
|
+
super().__init__(source_field=source_field, key=key)
|
112
|
+
|
113
|
+
@property
|
114
|
+
def mapping(self):
|
115
|
+
return {
|
116
|
+
self.attr_name: {
|
117
|
+
"type": "object",
|
118
|
+
"properties": {
|
119
|
+
lang: {
|
120
|
+
"type": "icu_collation_keyword",
|
121
|
+
"index": False,
|
122
|
+
"language": lang,
|
123
|
+
**setting.get("collation", {}),
|
124
|
+
}
|
125
|
+
for lang, setting in self.languages.items()
|
126
|
+
},
|
127
|
+
},
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
class ICUSuggestField(ICUField):
|
132
|
+
"""
|
133
|
+
A field that adds icu-aware suggestion field
|
134
|
+
"""
|
135
|
+
|
136
|
+
def __init__(self, source_field, key=None):
|
137
|
+
super().__init__(source_field=source_field, key=key)
|
138
|
+
|
139
|
+
@property
|
140
|
+
def mapping(self):
|
141
|
+
return {
|
142
|
+
self.attr_name: {
|
143
|
+
"type": "object",
|
144
|
+
"properties": {
|
145
|
+
lang: setting.get(
|
146
|
+
"suggest",
|
147
|
+
{
|
148
|
+
"type": "text",
|
149
|
+
"fields": {
|
150
|
+
"original": {
|
151
|
+
"type": "search_as_you_type",
|
152
|
+
},
|
153
|
+
"no_accent": {
|
154
|
+
"type": "search_as_you_type",
|
155
|
+
"analyzer": "accent_removal_analyzer",
|
156
|
+
},
|
157
|
+
},
|
158
|
+
},
|
159
|
+
)
|
160
|
+
for lang, setting in self.languages.items()
|
161
|
+
},
|
162
|
+
},
|
163
|
+
}
|
164
|
+
|
165
|
+
@property
|
166
|
+
def mapping_settings(self):
|
167
|
+
return {
|
168
|
+
"analysis": {
|
169
|
+
"analyzer": {
|
170
|
+
"accent_removal_analyzer": {
|
171
|
+
"type": "custom",
|
172
|
+
"tokenizer": "standard",
|
173
|
+
"filter": ["lowercase", "asciifolding"],
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
|
180
|
+
class ICUSearchAnalyzerMixin:
|
181
|
+
|
182
|
+
default_stemming_analyzers = {
|
183
|
+
"stemming_analyzer_cs": {
|
184
|
+
"tokenizer": "standard",
|
185
|
+
"filter": ["stemming_filter_cs", "lowercase"],
|
186
|
+
},
|
187
|
+
"stemming_analyzer_en": {
|
188
|
+
"tokenizer": "standard",
|
189
|
+
"filter": ["stemming_filter_en", "lowercase"],
|
190
|
+
},
|
191
|
+
"ascii_folding_analyzer": {
|
192
|
+
"tokenizer": "standard",
|
193
|
+
"filter": ["ascii_folding_filter", "lowercase"],
|
194
|
+
},
|
195
|
+
"lowercase_analyzer": {
|
196
|
+
"tokenizer": "standard",
|
197
|
+
"filter": ["lowercase"],
|
198
|
+
},
|
199
|
+
}
|
200
|
+
|
201
|
+
default_stemming_filters = {
|
202
|
+
"stemming_filter_cs": {
|
203
|
+
"type": "stemmer",
|
204
|
+
"name": "czech",
|
205
|
+
"language": "czech",
|
206
|
+
},
|
207
|
+
"stemming_filter_en": {
|
208
|
+
"type": "stemmer",
|
209
|
+
"name": "english",
|
210
|
+
"language": "english",
|
211
|
+
},
|
212
|
+
"ascii_folding_filter": {"type": "asciifolding", "preserve_original": True},
|
213
|
+
}
|
214
|
+
|
215
|
+
@property
|
216
|
+
def mapping_settings(self):
|
217
|
+
return {
|
218
|
+
"analysis": {
|
219
|
+
"analyzer": current_app.config.get(
|
220
|
+
"OAREPO_ICU_SEARCH_ANALYZERS", self.default_stemming_analyzers
|
221
|
+
),
|
222
|
+
"filter": current_app.config.get(
|
223
|
+
"OAREPO_ICU_SEARCH_FILTERS", self.default_stemming_filters
|
224
|
+
),
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
|
229
|
+
class ICUSearchField(ICUSearchAnalyzerMixin, ICUField):
|
230
|
+
"""
|
231
|
+
A field that adds stemming-aware search field for multilingual data (
|
232
|
+
e.g. data that contains {"cs": "...", "en": "..."}
|
233
|
+
or [{"lang": "cs", "value": "..."}, ...]
|
234
|
+
)
|
235
|
+
"""
|
236
|
+
|
237
|
+
def __init__(self, source_field, key=None, boost=1):
|
238
|
+
super().__init__(source_field=source_field, key=key)
|
239
|
+
self.boost = boost
|
240
|
+
|
241
|
+
@property
|
242
|
+
def mapping(self):
|
243
|
+
return {
|
244
|
+
self.attr_name: {
|
245
|
+
"type": "object",
|
246
|
+
"properties": {
|
247
|
+
# normal stemming
|
248
|
+
lang: setting.get(
|
249
|
+
"search",
|
250
|
+
{
|
251
|
+
"type": "text",
|
252
|
+
"boost": 1 * self.boost,
|
253
|
+
"fields": {
|
254
|
+
"stemmed": {
|
255
|
+
"type": "text",
|
256
|
+
"analyzer": f"stemming_analyzer_{lang}",
|
257
|
+
"boost": 0.5 * self.boost,
|
258
|
+
},
|
259
|
+
"lowercase": {
|
260
|
+
"type": "text",
|
261
|
+
"boost": 0.8 * self.boost,
|
262
|
+
"analyzer": "lowercase_analyzer",
|
263
|
+
},
|
264
|
+
"ascii_folded": {
|
265
|
+
"type": "text",
|
266
|
+
"analyzer": "ascii_folding_analyzer",
|
267
|
+
"boost": 0.3 * self.boost,
|
268
|
+
},
|
269
|
+
},
|
270
|
+
},
|
271
|
+
)
|
272
|
+
for lang, setting in self.languages.items()
|
273
|
+
},
|
274
|
+
},
|
275
|
+
}
|
276
|
+
|
277
|
+
def get_values(self, data, language):
|
278
|
+
return super().get_values(data, language=language)
|
279
|
+
|
280
|
+
|
281
|
+
class SingleLanguageSearchField(ICUSearchAnalyzerMixin, ICUBase):
|
282
|
+
"""
|
283
|
+
A base class for single-language search fields - that is, data contain a text
|
284
|
+
value in a pre-defined, single language.
|
285
|
+
"""
|
286
|
+
|
287
|
+
def __init__(self, *, source_field, key=None, language=None, boost=1):
|
288
|
+
super().__init__(source_field=source_field, key=key)
|
289
|
+
self.language = language
|
290
|
+
self.boost = boost
|
291
|
+
|
292
|
+
def search_dump(self, data, record):
|
293
|
+
"""Dump custom field."""
|
294
|
+
ret = self.get_values(data, language=self.language)
|
295
|
+
if ret:
|
296
|
+
data[self.attr_name] = ret
|
297
|
+
|
298
|
+
|
299
|
+
class FulltextIndexField(SingleLanguageSearchField):
|
300
|
+
"""
|
301
|
+
A system field that makes the field searchable in OpenSearch,
|
302
|
+
regardless if it is indexed/analyzed, embedded in Nested or not.
|
303
|
+
|
304
|
+
It creates a top-level mapping field and copies
|
305
|
+
content of {source_field} into it. It also provides the correct mapping
|
306
|
+
for the field based on the current configuration of the application.
|
307
|
+
|
308
|
+
Unlike the ICU, this field is a single-language and the language should
|
309
|
+
be provided when initializing the field.
|
310
|
+
It defaults to the BABEL_DEFAULT_LOCALE if not provided.
|
311
|
+
"""
|
312
|
+
|
313
|
+
@property
|
314
|
+
def mapping(self):
|
315
|
+
language = self.language or current_app.config.get("BABEL_DEFAULT_LOCALE", "en")
|
316
|
+
mapping_settings = self.languages.get(language, None)
|
317
|
+
if mapping_settings:
|
318
|
+
mapping_settings = mapping_settings.get("search")
|
319
|
+
if not mapping_settings:
|
320
|
+
mapping_settings = {
|
321
|
+
"type": "text",
|
322
|
+
"boost": 1 * self.boost,
|
323
|
+
"fields": {
|
324
|
+
"stemmed": {
|
325
|
+
"type": "text",
|
326
|
+
"analyzer": f"stemming_analyzer_{language}",
|
327
|
+
"boost": 0.5 * self.boost,
|
328
|
+
},
|
329
|
+
"lowercase": {
|
330
|
+
"type": "text",
|
331
|
+
"boost": 0.8 * self.boost,
|
332
|
+
"analyzer": "lowercase_analyzer",
|
333
|
+
},
|
334
|
+
"ascii_folded": {
|
335
|
+
"type": "text",
|
336
|
+
"analyzer": "ascii_folding_analyzer",
|
337
|
+
"boost": 0.3 * self.boost,
|
338
|
+
},
|
339
|
+
},
|
340
|
+
}
|
341
|
+
|
342
|
+
return {self.attr_name: mapping_settings}
|
343
|
+
|
344
|
+
def search_load(self, data, record_cls):
|
345
|
+
"""Load custom field."""
|
346
|
+
data.pop(self.attr_name, None)
|
347
|
+
|
348
|
+
|
349
|
+
class TermIndexField(SingleLanguageSearchField):
|
350
|
+
"""
|
351
|
+
A system field that makes the field searchable in OpenSearch,
|
352
|
+
regardless if it is indexed/analyzed, embedded in Nested or not.
|
353
|
+
|
354
|
+
It creates a top-level mapping field and copies
|
355
|
+
content of {source_field} into it. It also provides the correct mapping
|
356
|
+
for the field based on the current configuration of the application.
|
357
|
+
|
358
|
+
Unlike the ICU, this field is a single-language and the language should
|
359
|
+
be provided when initializing the field.
|
360
|
+
It defaults to the BABEL_DEFAULT_LOCALE if not provided.
|
361
|
+
"""
|
362
|
+
|
363
|
+
@property
|
364
|
+
def mapping(self):
|
365
|
+
mapping_settings = {
|
366
|
+
"type": "keyword",
|
367
|
+
"boost": 1 * self.boost,
|
368
|
+
"ignore_above": 256,
|
369
|
+
}
|
370
|
+
|
371
|
+
return {self.attr_name: mapping_settings}
|
{oarepo_runtime-1.7.2 → oarepo_runtime-1.9.0}/oarepo_runtime/records/systemfields/mapping.py
RENAMED
@@ -16,12 +16,10 @@ class MappingSystemFieldMixin:
|
|
16
16
|
def dynamic_templates(self):
|
17
17
|
return []
|
18
18
|
|
19
|
-
|
20
|
-
def search_dump(cls, data, record):
|
19
|
+
def search_dump(self, data, record):
|
21
20
|
"""Dump custom field."""
|
22
21
|
|
23
|
-
|
24
|
-
def search_load(cls, data, record_cls):
|
22
|
+
def search_load(self, data, record_cls):
|
25
23
|
"""Load custom field."""
|
26
24
|
|
27
25
|
|
@@ -1,214 +0,0 @@
|
|
1
|
-
from functools import cached_property
|
2
|
-
from typing import Dict
|
3
|
-
|
4
|
-
from flask import current_app
|
5
|
-
from invenio_records.systemfields import SystemField
|
6
|
-
|
7
|
-
from oarepo_runtime.records.relations.lookup import lookup_key
|
8
|
-
from oarepo_runtime.records.systemfields.mapping import MappingSystemFieldMixin
|
9
|
-
|
10
|
-
|
11
|
-
class ICUField(MappingSystemFieldMixin, SystemField):
|
12
|
-
"""
|
13
|
-
A system field that acts as an opensearch "proxy" to another field.
|
14
|
-
It creates a top-level mapping field with the same name and copies
|
15
|
-
content of {another field}.language into {mapping field}.language.
|
16
|
-
|
17
|
-
The language accessor can be modified by overriding get_values method.
|
18
|
-
"""
|
19
|
-
|
20
|
-
def __init__(self, *, source_field, key=None):
|
21
|
-
super().__init__(key)
|
22
|
-
self.source_field = source_field
|
23
|
-
|
24
|
-
@cached_property
|
25
|
-
def languages(self) -> Dict[str, Dict]:
|
26
|
-
icu_languages = current_app.config.get("OAREPO_ICU_LANGUAGES", {})
|
27
|
-
if icu_languages:
|
28
|
-
return icu_languages
|
29
|
-
|
30
|
-
primary_language = current_app.config.get("BABEL_DEFAULT_LOCALE", "en")
|
31
|
-
# list of tuples [lang, title], just take lang
|
32
|
-
babel_languages = [x[0] for x in current_app.config.get("I18N_LANGUAGES", [])]
|
33
|
-
|
34
|
-
return {primary_language: {}, **{k: {} for k in babel_languages}}
|
35
|
-
|
36
|
-
def get_values(self, data, language):
|
37
|
-
ret = []
|
38
|
-
for l in lookup_key(data, f"{self.source_field}"):
|
39
|
-
if isinstance(l.value, str):
|
40
|
-
ret.append(l.value)
|
41
|
-
elif isinstance(l.value, dict):
|
42
|
-
val = l.value.get(language)
|
43
|
-
if val:
|
44
|
-
ret.append(val)
|
45
|
-
return ret
|
46
|
-
|
47
|
-
def search_dump(self, data, record):
|
48
|
-
ret = {}
|
49
|
-
for lang in self.languages:
|
50
|
-
ret[lang] = self.get_values(data, lang)
|
51
|
-
data[self.attr_name] = ret
|
52
|
-
|
53
|
-
def search_load(self, data, record_cls):
|
54
|
-
data.pop(self.attr_name, None)
|
55
|
-
|
56
|
-
def __get__(self, instance, owner):
|
57
|
-
return self
|
58
|
-
|
59
|
-
|
60
|
-
class ICUSortField(ICUField):
|
61
|
-
"""
|
62
|
-
A field that adds icu sorting field
|
63
|
-
"""
|
64
|
-
|
65
|
-
def __init__(self, *, source_field, key=None):
|
66
|
-
super().__init__(source_field=source_field, key=key)
|
67
|
-
|
68
|
-
@property
|
69
|
-
def mapping(self):
|
70
|
-
return {
|
71
|
-
self.attr_name: {
|
72
|
-
"type": "object",
|
73
|
-
"properties": {
|
74
|
-
lang: {
|
75
|
-
"type": "icu_collation_keyword",
|
76
|
-
"index": False,
|
77
|
-
"language": lang,
|
78
|
-
**setting.get("collation", {}),
|
79
|
-
}
|
80
|
-
for lang, setting in self.languages.items()
|
81
|
-
},
|
82
|
-
},
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
class ICUSuggestField(ICUField):
|
87
|
-
"""
|
88
|
-
A field that adds icu-aware suggestion field
|
89
|
-
"""
|
90
|
-
|
91
|
-
def __init__(self, source_field, key=None):
|
92
|
-
super().__init__(source_field=source_field, key=key)
|
93
|
-
|
94
|
-
@property
|
95
|
-
def mapping(self):
|
96
|
-
return {
|
97
|
-
self.attr_name: {
|
98
|
-
"type": "object",
|
99
|
-
"properties": {
|
100
|
-
lang: setting.get(
|
101
|
-
"suggest",
|
102
|
-
{
|
103
|
-
"type": "text",
|
104
|
-
"fields": {
|
105
|
-
"original": {
|
106
|
-
"type": "search_as_you_type",
|
107
|
-
},
|
108
|
-
"no_accent": {
|
109
|
-
"type": "search_as_you_type",
|
110
|
-
"analyzer": "accent_removal_analyzer",
|
111
|
-
},
|
112
|
-
},
|
113
|
-
},
|
114
|
-
)
|
115
|
-
for lang, setting in self.languages.items()
|
116
|
-
},
|
117
|
-
},
|
118
|
-
}
|
119
|
-
|
120
|
-
@property
|
121
|
-
def mapping_settings(self):
|
122
|
-
return {
|
123
|
-
"analysis": {
|
124
|
-
"analyzer": {
|
125
|
-
"accent_removal_analyzer": {
|
126
|
-
"type": "custom",
|
127
|
-
"tokenizer": "standard",
|
128
|
-
"filter": ["lowercase", "asciifolding"],
|
129
|
-
}
|
130
|
-
}
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
|
135
|
-
class ICUSearchField(ICUField):
|
136
|
-
"""
|
137
|
-
A field that adds stemming-aware search field
|
138
|
-
"""
|
139
|
-
|
140
|
-
default_stemming_analyzers = {
|
141
|
-
"stemming_analyzer_cs": {
|
142
|
-
"tokenizer": "standard",
|
143
|
-
"filter": ["stemming_filter_cs"],
|
144
|
-
},
|
145
|
-
"stemming_analyzer_en": {
|
146
|
-
"tokenizer": "standard",
|
147
|
-
"filter": ["stemming_filter_en"],
|
148
|
-
},
|
149
|
-
"ascii_folding_analyzer": {
|
150
|
-
"tokenizer": "standard",
|
151
|
-
"filter": ["ascii_folding_filter"],
|
152
|
-
},
|
153
|
-
}
|
154
|
-
|
155
|
-
default_stemming_filters = {
|
156
|
-
"stemming_filter_cs": {
|
157
|
-
"type": "stemmer",
|
158
|
-
"name": "czech",
|
159
|
-
"language": "czech",
|
160
|
-
},
|
161
|
-
"stemming_filter_en": {
|
162
|
-
"type": "stemmer",
|
163
|
-
"name": "english",
|
164
|
-
"language": "english",
|
165
|
-
},
|
166
|
-
"ascii_folding_filter": {"type": "asciifolding", "preserve_original": True},
|
167
|
-
}
|
168
|
-
|
169
|
-
def __init__(self, source_field, key=None):
|
170
|
-
super().__init__(source_field=source_field, key=key)
|
171
|
-
|
172
|
-
@property
|
173
|
-
def mapping(self):
|
174
|
-
return {
|
175
|
-
self.attr_name: {
|
176
|
-
"type": "object",
|
177
|
-
"properties": {
|
178
|
-
# normal stemming
|
179
|
-
lang: setting.get(
|
180
|
-
"search",
|
181
|
-
{
|
182
|
-
"type": "text",
|
183
|
-
"boost": 1,
|
184
|
-
"fields": {
|
185
|
-
"stemmed": {
|
186
|
-
"type": "text",
|
187
|
-
"analyzer": f"stemming_analyzer_{lang}",
|
188
|
-
"boost": 0.5,
|
189
|
-
},
|
190
|
-
"ascii_folded": {
|
191
|
-
"type": "text",
|
192
|
-
"analyzer": "ascii_folding_analyzer",
|
193
|
-
"boost": 0.3,
|
194
|
-
},
|
195
|
-
},
|
196
|
-
},
|
197
|
-
)
|
198
|
-
for lang, setting in self.languages.items()
|
199
|
-
},
|
200
|
-
},
|
201
|
-
}
|
202
|
-
|
203
|
-
@property
|
204
|
-
def mapping_settings(self):
|
205
|
-
return {
|
206
|
-
"analysis": {
|
207
|
-
"analyzer": current_app.config.get(
|
208
|
-
"OAREPO_ICU_SEARCH_ANALYZERS", self.default_stemming_analyzers
|
209
|
-
),
|
210
|
-
"filter": current_app.config.get(
|
211
|
-
"OAREPO_ICU_SEARCH_FILTERS", self.default_stemming_filters
|
212
|
-
),
|
213
|
-
}
|
214
|
-
}
|