From 4cc7ef0f37ab10ab62137c329065a20838495c34 Mon Sep 17 00:00:00 2001 From: Andrzej Kopytko Date: Fri, 15 Nov 2024 09:11:44 +0100 Subject: [PATCH] [DOCS Added new hierarchical field for Coveo (#27569) ### Details: - *item1* - *...* ### Tickets: - *ticket-id* --- .../__init__.py | 17 +- docs/sphinx_setup/_templates/search.html | 434 ++++++++++++++---- docs/sphinx_setup/conf.py | 3 +- 3 files changed, 356 insertions(+), 98 deletions(-) diff --git a/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py b/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py index c82e0a8d5995f7..ca93d02d75c6a9 100644 --- a/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py +++ b/docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py @@ -120,15 +120,24 @@ def process_coveo_meta(meta, url, link): for namespace, values in meta: namespace_element = ET.SubElement(url, namespace) + loc_element = url.find("loc") for tag_name, tag_value in values.items(): if tag_name == 'ovdoctype': - processed_link = process_link(link) - ET.SubElement(namespace_element, tag_name).text = processed_link - else: + ET.SubElement(namespace_element, tag_name).text = process_link(link) + elif tag_name == 'ovcategory' and loc_element is not None: + ET.SubElement(namespace_element, tag_name).text = extract_link(loc_element.text) + elif tag_name == 'ovversion': ET.SubElement(namespace_element, tag_name).text = tag_value def process_link(link): if '/' in link: return link.split('/')[0].replace("-", " ") - return link.split('.html')[0].replace("-", " ") \ No newline at end of file + return link.split('.html')[0].replace("-", " ") + +def extract_link(link): + path = link.split("://")[-1] + segments = path.split('/')[1:] + if segments and segments[-1].endswith('.html'): + segments = segments[:-1] + return '|'.join(segments) \ No newline at end of file diff --git a/docs/sphinx_setup/_templates/search.html b/docs/sphinx_setup/_templates/search.html index 5430f24f74aa8c..e6fb092876277d 100644 --- a/docs/sphinx_setup/_templates/search.html +++ b/docs/sphinx_setup/_templates/search.html @@ -1,101 +1,349 @@ -{%- extends "layout.html" %} -{% set title = _('Search') %} - -{%- block content %} -{% block docs_navbar %} -{{ super() }} -{% include 'baner.html' %} -{% endblock %} - -{% block body %} - - - - - - - - -
- - + + + + + + + + + Search — OpenVINO™ documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +