Index Tool for Search

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):
"""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.
"""
service_list = []
doc_types = []
docs = []
for service in self.all_services:
if not service["service_title"]:
@ -139,8 +139,15 @@ class Services(object):
"type": doc["type"]
})
if doc["type"] not in doc_types:
doc_types.append(doc["type"])
new_doc = {
"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_title": service["service_title"],
@ -150,7 +157,7 @@ class Services(object):
res = {
"services": service_list,
"doc_types": doc_types
"docs": docs
}
return res

View File

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

151
tools/index_metadata.py Normal file

File diff suppressed because it is too large Load Diff