-
Notifications
You must be signed in to change notification settings - Fork 7
Description
The latest changes address the different cases:
[1] CASE-1: ZMS_INSERT
- is page-like class and filterMatch of current node (eg. new ZMSFolder)
- is not page-like and filterMatch of container-page (eg. new ZMSTextarea into ZMSFolder)
- is not page-like and filterMatch of current node (e.g. new ZMSFile)
[2] CASE-2: CHANGE
- container-page is not current node and filterMatch of container-page
- filterMatch of current node
ZMS/Products/zms/ZMSZCatalogAdapter.py
Lines 201 to 222 in 1b4ec16
| # Reindex node's content by each connector. | |
| for connector in connectors: | |
| if self.matches_ids_filter(node) or self.matches_ids_filter(page): | |
| # CASE-1: ZMS_INSERT | |
| # Reindex the current node if page or its container page. | |
| if self.REQUEST.get('ZMS_INSERT', None): | |
| if node.isPage() and self.matches_ids_filter(node): | |
| self.reindex(connector, node, recursive=False, fileparsing=fileparsing) | |
| elif not node.isPage() and self.matches_ids_filter(page): | |
| self.reindex(connector, page, recursive=False, fileparsing=fileparsing) | |
| if not node.isPage() and self.matches_ids_filter(node): | |
| # After reindexing the page add the node if filter-match. | |
| self.reindex(connector, node, recursive=False, fileparsing=fileparsing) | |
| # CASE-2: CHANGE | |
| # Reindex container page if node!=page and the node if filter-match. | |
| else: | |
| if node != page and self.matches_ids_filter(page): | |
| self.reindex(connector, page, recursive=False, fileparsing=fileparsing) | |
| if self.matches_ids_filter(node): | |
| self.reindex(connector, node, recursive=False, fileparsing=fileparsing) |
The incremental reindex still shows a surprising logical (?) problem: on ZMS_INSERT the content of the container page is aggregated only of the content-objects that have the same meta_id like the objects that is inserted. Exp: if a ZMSTextarea is added to a document, the indexed page content only concats the ZMSTextarea-content but ignores any other object class e.g. the content of ZMSTable-object.
It seems that the context that is needed for the attribute rendering is in case of standard_html not referring to the iterated object's standard_html, LINE 355 child_node.getBodyContent(request):
ZMS/Products/zms/ZMSZCatalogAdapter.py
Lines 349 to 357 in 1b4ec16
| try: | |
| # ZMSFile.standard_html will work in get_file. | |
| if not (node.meta_id == 'ZMSFile' and attr_id == 'standard_html'): | |
| if attr_id == 'standard_html' and request.get('ZMS_INSERT', None) and node.isPage(): | |
| # ZMS_INSERT Page: attr('standard_html') does not work. | |
| for child_node in node.getObjChildren('e',request,self.PAGEELEMENTS): | |
| value += child_node.getBodyContent(request) | |
| else: | |
| value = node.attr(attr_id) |
[1] On INSERTING an new ZMSTextarea prevents Reindexing Page-Content not derived from ZMSTextarea

[2] On CHANGE a PAGEELEMENT or the PAGE-Container renders/reindexes the full content

Debugging the get_attr_data()-iteration
ZMS/Products/zms/ZMSZCatalogAdapter.py
Lines 353 to 355 in 1b4ec16
| # ZMS_INSERT Page: attr('standard_html') does not work. | |
| for child_node in node.getObjChildren('e',request,self.PAGEELEMENTS): | |
| value += child_node.getBodyContent(request) |
reveals that standard_html-attr of the inserted obj-class is applied and not the one of the iterated item. In case of ZMSFile this results in empty data for any ZMSTextarea, because the standard_html of ZMSFile cannot render ZMSTextarea appropiately.
The other way round: if inserting a ZMSTextarea the ZMSFile cannot be renderd
child_node.meta_id
'ZMSFile'
child_node.getBodyContent(request)
'<!-- ZMSTextarea.standard_html -->\n\n\n\n<!-- /ZMSTextarea.standard_html -->'
child_node.attr('standard_html')
'<!-- ZMSTextarea.standard_html -->\n\n\n\n<!-- /ZMSTextarea.standard_html -->'
child_node.attr('title')
'antrag.pdf'
NOTE: Fullindex works correctly and thus corrects any missing page content.
Ref:
[1] Ensure Reindexing Context's Page Container on Change/Insert #277
[2] https://github.com/idasm-unibe-ch/unibe-cms-opensearch/issues/50
