From d7b002aaf21aaf5f28a022235a8b68d919c67a2a Mon Sep 17 00:00:00 2001 From: drfho Date: Thu, 4 Jul 2024 21:40:25 +0200 Subject: [PATCH] opensearch: update readme --- .../opensearch_connector/readme | 20 +++++++++++++++++-- .../zpt/ZMSZCatalogAdapter/manage_main.zpt | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Products/zms/conf/metaobj_manager/com.zms.catalog.opensearch/opensearch_connector/readme b/Products/zms/conf/metaobj_manager/com.zms.catalog.opensearch/opensearch_connector/readme index 3272c847b..af3f576a7 100644 --- a/Products/zms/conf/metaobj_manager/com.zms.catalog.opensearch/opensearch_connector/readme +++ b/Products/zms/conf/metaobj_manager/com.zms.catalog.opensearch/opensearch_connector/readme @@ -7,7 +7,23 @@ Before letting Opensearch create an index, Opensearch needs to know how to index the _ZMS Catalog Adapter GUI_ helps creating that schema: any content types (usually _pages_) and attributes can be selected to get indexed. Usually the _standard_html_-attribute provides the full text whereas other attributes can be added specifically like _title_, _titlealt_, _description_. Their content may be applied when search results are listed. -ZMS will send to the index only the content of the by _ZMS Catalog Adapter_ selected contenttypes and its selected attributes. So before starting, please make sure that the selections in the _ZMS Catalog Adapter GUI_ is correct. +ZMS will send to the index only the content of the by _ZMS Catalog Adapter_ selected contenttypes and its selected attributes. So before starting, please make sure that the selections in the _ZMS Catalog Adapter GUI_ is correct and take a careful look at the _Custom Filter-Function_ for selecting the documents to be indexed. Especially `breadcrumbs_obj_path()`-expressions may result in unexpected exclusions. Example: + +
+## filter excludes the following objects:
+## - inactive
+## - redirects
+## - robots = noindex, nofollow
+return (context.meta_id in meta_ids) \
+    and len([ob for ob in context.breadcrumbs_obj_path() if not ob.isActive(context.REQUEST)])==0  \
+    and not context.meta_id == 'ZMSFormulator' \
+    and not context.attr('attr_dc_identifier_url_redirect') \
+    and ('noindex' not in context.attr('attr_robots')) \
+    and ('none' not in context.attr('attr_robots')) \
+    and len( [ ob for ob in context.breadcrumbs_obj_path() if ( ( 'nofollow' in ob.attr('attr_robots') ) ) ] )==0 \
+    and context.isVisible(context.REQUEST)
+
+ ###### Start with _Create Schema_ ! @@ -62,7 +78,7 @@ To boost the relevance of certain fields in the search results, the Opensearch c int wght = 1; ZonedDateTime dt_limit = ZonedDateTime.parse('2023-01-01T00:00:00+00:00'); ZonedDateTime dt_doc = dt_limit; -if ( doc.containsKey('created_dt') ){ +if ( doc.containsKey('created_dt') && !doc['created_dt'].empty){ dt_doc = doc['created_dt'].value; } if ( doc.containsKey('meta_id') ) { diff --git a/Products/zms/zpt/ZMSZCatalogAdapter/manage_main.zpt b/Products/zms/zpt/ZMSZCatalogAdapter/manage_main.zpt index f47acb286..a7c30a811 100644 --- a/Products/zms/zpt/ZMSZCatalogAdapter/manage_main.zpt +++ b/Products/zms/zpt/ZMSZCatalogAdapter/manage_main.zpt @@ -36,7 +36,8 @@ ##
return (context.meta_id in meta_ids) \
  and not [ob for ob in context.breadcrumbs_obj_path() if not ob.isActive(context.REQUEST)] \
-   and not context.attr('attr_dc_type')=='Resource'
+   and not context.attr('attr_dc_type')=='Resource' \
+   and context.isVisible(context.REQUEST)