Index Tool for Search
Some checks are pending
gl/check check status: pending (3a84eaeec0347fa1bee7e0f4cbe62ee2684aa209)

Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Gode, Sebastian <sebastian.gode@t-systems.com>
Co-committed-by: Gode, Sebastian <sebastian.gode@t-systems.com>
This commit is contained in:
Gode, Sebastian 2023-06-27 07:57:25 +00:00 committed by zuul
parent 7b247f1e70
commit 3a84eaeec0
3 changed files with 164 additions and 5 deletions

View File

@ -115,12 +115,12 @@ class Services(object):
def service_types_with_doc_types(self, environment=None): def service_types_with_doc_types(self, environment=None):
"""Retrieve type and title from services and corresponding docs. """Retrieve type and title from services and corresponding docs.
As well as a list of all doc_types. As well as a list of all available doc types with title.
:param str environment: Optional service environment. :param str environment: Optional service environment.
""" """
service_list = [] service_list = []
doc_types = [] docs = []
for service in self.all_services: for service in self.all_services:
if not service["service_title"]: if not service["service_title"]:
@ -139,8 +139,15 @@ class Services(object):
"type": doc["type"] "type": doc["type"]
}) })
if doc["type"] not in doc_types: new_doc = {
doc_types.append(doc["type"]) "type": doc["type"],
"title": doc["title"]
}
type_exists = any(
doc_dict["type"] == new_doc["type"] for doc_dict in docs
)
if not type_exists:
docs.append(new_doc)
service_list.append({ service_list.append({
"service_title": service["service_title"], "service_title": service["service_title"],
@ -150,7 +157,7 @@ class Services(object):
res = { res = {
"services": service_list, "services": service_list,
"doc_types": doc_types "docs": docs
} }
return res return res

View File

@ -4,3 +4,4 @@ requests
jinja2 jinja2
dirsync dirsync
cookiecutter cookiecutter
opensearch-py

151
tools/index_metadata.py Normal file

File diff suppressed because it is too large Load Diff