AttributeError: 'TextIndex' object has no attribute 'getId'

I am working on migrating a site from 4.3.18 to 5.2 and Python3. I have been able to migrate the site to 5.0.10 and it works fine there. The site fails to load after Plone 5.0.10 is restarted. I am seeing AttributeError: 'TextIndex' object has no attribute 'getId' in the bin/instance fg output when I browse to the site. Before migrating the site, I used /@@plone-addsite to uninstalled all add-ons except the Archetypes Content Types for Plone add-on. I used ./install.sh --target=/opt/plone5.0.10 --with-python=/usr/bin/python2.7 standalone to install Plone 5.0.10 and copied filestorage and blobstorage in the var directory.

What should I do to migrate this site to 5.1.6?

Below is the bin/instance fg output and below that the upgrade report.

Thanks,
Michael

> bin/instance fg
> 2021-11-17 21:55:16 INFO ZServer HTTP server started at Wed Nov 17 21:55:16 2021
> 	Hostname: 0.0.0.0
> 	Port: 8080
> 2021-11-17 21:55:16 INFO Zope Set effective user to "plone_daemon"
> 2021-11-17 21:55:22 INFO Zope Ready to handle requests
> 2021-11-17 21:55:52 ERROR Zope.SiteErrorLog 1637214952.890.145820952591 http://testing.losaltosrobotics.org:8080/Main/index_html/document_view
> Traceback (innermost last):
>   Module ZPublisher.Publish, line 138, in publish
>   Module ZPublisher.mapply, line 77, in mapply
>   Module ZPublisher.Publish, line 48, in call_object
>   Module Shared.DC.Scripts.Bindings, line 322, in __call__
>   Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
>   Module Products.CMFCore.FSPageTemplate, line 237, in _exec
>   Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
>   Module Products.PageTemplates.PageTemplate, line 87, in pt_render
>   Module zope.pagetemplate.pagetemplate, line 137, in pt_render
>   Module five.pt.engine, line 98, in __call__
>   Module z3c.pt.pagetemplate, line 163, in render
>   Module chameleon.zpt.template, line 261, in render
>   Module chameleon.template, line 191, in render
>   Module chameleon.template, line 171, in render
>   Module 20165a125b14fc0307e425b2cc906fce.py, line 183, in render
>   Module 0e2fd1b1fb0b2a21e0745729de130b96.py, line 1055, in render_master
>   Module z3c.pt.expressions, line 71, in render_content_provider
>   Module zope.viewlet.manager, line 112, in update
>   Module zope.viewlet.manager, line 118, in _updateViewlets
>   Module plone.app.layout.viewlets.common, line 208, in update
>   Module Products.CMFPlone.browser.navigation, line 142, in topLevelTabs
>   Module Products.CMFPlone.CatalogTool, line 527, in searchResults
>   Module Products.ZCatalog.ZCatalog, line 604, in searchResults
>   Module Products.ZCatalog.Catalog, line 1072, in searchResults
>   Module Products.ZCatalog.Catalog, line 526, in search
>   Module Products.ZCatalog.Catalog, line 1081, in getCatalogPlan
>   Module Products.ZCatalog.plan, line 156, in __init__
>   Module Products.ZCatalog.Catalog, line 481, in _get_index_query_names
> AttributeError: 'TextIndex' object has no attribute 'getId'
> 
>  - Expression: "provider:plone.mainnavigation"
>  - Filename:   ... egg/Products/CMFPlone/browser/templates/main_template.pt
>  - Location:   (line 57: col 59)
>  - Source:     ... er:plone.portaltop" />
>                                       ^
>  - Arguments:  repeat: {...} (0)
>                template: <ImplicitAcquisitionWrapper document_view at 0x7ff656d06be0>
>                modules: <instance - at 0x7ff65d4c8638>
>                here: <ImplicitAcquisitionWrapper index_html at 0x7ff656d15dc0>
>                user: <ImplicitAcquisitionWrapper - at 0x7ff656ca8eb0>
>                nothing: <NoneType - at 0x5619ddab2110>
>                container: <ImplicitAcquisitionWrapper Main at 0x7ff658b24e10>
>                default: <object - at 0x7ff65fd28560>
>                request: <instance - at 0x7ff656712dd0>
>                wrapped_repeat: <SafeMapping - at 0x7ff65501eec0>
>                traverse_subpath: <list - at 0x7ff656315ab8>
>                loop: {...} (0)
>                context: <ImplicitAcquisitionWrapper index_html at 0x7ff656d15dc0>
>                translate: <function translate at 0x7ff6564ca7d0>
>                root: <ImplicitAcquisitionWrapper Zope at 0x7ff658b89aa0>
>                options: {...} (1)
>                target_language: <NoneType - at 0x5619ddab2110>
> 2021-11-17 21:55:52 INFO PythonScripts Some of your Scripts have stale code cached.  Since Zope cannot use this code, startup will be slightly slower until these Scripts are edited. You can automatically recompile all Scripts that have this problem by visiting /manage_addProduct/PythonScripts/recompile of your server in a browser.
> 2021-11-17 21:55:53 ERROR root Exception while rendering an error message
> Traceback (most recent call last):
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/OFS/SimpleItem.py", line 242, in raise_standardErrorMessage
>     v = s(**kwargs)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
>     return self._bindAndExec(args, kw, None)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
>     return self._exec(bound_data, args, kw)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.PythonScripts-2.13.2-py2.7.egg/Products/PythonScripts/PythonScript.py", line 344, in _exec
>     result = f(*args, **kw)
>   File "Script (Python)", line 16, in standard_error_message
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
>     return self._bindAndExec(args, kw, None)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
>     return self._exec(bound_data, args, kw)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.CMFCore-2.2.13-py2.7.egg/Products/CMFCore/FSPageTemplate.py", line 237, in _exec
>     result = self.pt_render(extra_context=bound_names)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.CMFCore-2.2.13-py2.7.egg/Products/CMFCore/FSPageTemplate.py", line 177, in pt_render
>     self, source, extra_context
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Zope2-2.13.29-py2.7.egg/Products/PageTemplates/PageTemplate.py", line 87, in pt_render
>     showtal=showtal)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/zope.pagetemplate-4.2.1-py2.7.egg/zope/pagetemplate/pagetemplate.py", line 137, in pt_render
>     strictinsert=0, sourceAnnotations=sourceAnnotations
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/five.pt-2.2.5-py2.7.egg/five/pt/engine.py", line 98, in __call__
>     return self.template.render(**kwargs)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/z3c.pt-3.0.0a1-py2.7.egg/z3c/pt/pagetemplate.py", line 163, in render
>     return base_renderer(**context)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Chameleon-2.25-py2.7.egg/chameleon/zpt/template.py", line 261, in render
>     return super(PageTemplate, self).render(**vars)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Chameleon-2.25-py2.7.egg/chameleon/template.py", line 191, in render
>     raise_with_traceback(exc, tb)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Chameleon-2.25-py2.7.egg/chameleon/template.py", line 171, in render
>     self._render(stream, econtext, rcontext)
>   File "2c2ad20dac59050641f8b7dc37350c0c.py", line 1492, in render
>   File "0e2fd1b1fb0b2a21e0745729de130b96.py", line 1055, in render_master
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/z3c.pt-3.0.0a1-py2.7.egg/z3c/pt/expressions.py", line 71, in render_content_provider
>     cp.update()
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/zope.viewlet-3.7.2-py2.7.egg/zope/viewlet/manager.py", line 112, in update
>     self._updateViewlets()
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/zope.viewlet-3.7.2-py2.7.egg/zope/viewlet/manager.py", line 118, in _updateViewlets
>     viewlet.update()
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/plone.app.layout-2.8.4-py2.7.egg/plone/app/layout/viewlets/common.py", line 208, in update
>     self.portal_tabs = portal_tabs_view.topLevelTabs()
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.CMFPlone-5.1.6-py2.7.egg/Products/CMFPlone/browser/navigation.py", line 142, in topLevelTabs
>     rawresult = catalog.searchResults(query)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.CMFPlone-5.1.6-py2.7.egg/Products/CMFPlone/CatalogTool.py", line 527, in searchResults
>     return ZCatalog.searchResults(self, REQUEST, **kw)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.ZCatalog-3.0.3-py2.7.egg/Products/ZCatalog/ZCatalog.py", line 604, in searchResults
>     return self._catalog.searchResults(REQUEST, used, **kw)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.ZCatalog-3.0.3-py2.7.egg/Products/ZCatalog/Catalog.py", line 1072, in searchResults
>     return self.search(args, sort_indexes, reverse, sort_limit, _merge)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.ZCatalog-3.0.3-py2.7.egg/Products/ZCatalog/Catalog.py", line 526, in search
>     cr = self.getCatalogPlan(query)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.ZCatalog-3.0.3-py2.7.egg/Products/ZCatalog/Catalog.py", line 1081, in getCatalogPlan
>     return CatalogPlan(self, query, threshold)
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.ZCatalog-3.0.3-py2.7.egg/Products/ZCatalog/plan.py", line 156, in __init__
>     for querykey in self.catalog._get_index_query_names(index):
>   File "/opt/plone5.1.6.try2/buildout-cache/eggs/Products.ZCatalog-3.0.3-py2.7.egg/Products/ZCatalog/Catalog.py", line 481, in _get_index_query_names
>     return (index.getId(),)
> AttributeError: 'TextIndex' object has no attribute 'getId'
> 
>  - Expression: "provider:plone.mainnavigation"
>  - Filename:   ... egg/Products/CMFPlone/browser/templates/main_template.pt
>  - Location:   (line 57: col 59)
>  - Source:     ... er:plone.portaltop" />
>                                       ^
>  - Arguments:  repeat: {...} (0)
>                template: <ImplicitAcquisitionWrapper default_error_message at 0x7ff6583f85a0>
>                modules: <instance - at 0x7ff65d4c8638>
>                here: <ImplicitAcquisitionWrapper index_html at 0x7ff656d15dc0>
>                user: <ImplicitAcquisitionWrapper - at 0x7ff656ca8eb0>
>                nothing: <NoneType - at 0x5619ddab2110>
>                container: <ImplicitAcquisitionWrapper Main at 0x7ff658b24e10>
>                default: <object - at 0x7ff65fd28560>
>                request: <instance - at 0x7ff656712dd0>
>                wrapped_repeat: <SafeMapping - at 0x7ff6552a6d60>
>                traverse_subpath: <list - at 0x7ff656315ab8>
>                loop: {...} (0)
>                context: <ImplicitAcquisitionWrapper index_html at 0x7ff656d15dc0>
>                translate: <function translate at 0x7ff6552a09b0>
>                root: <ImplicitAcquisitionWrapper Zope at 0x7ff658b89aa0>
>                options: {...} (5)
>                target_language: <NoneType - at 0x5619ddab2110>

Here is the 5.0.10 to 5.1.6 upgrade report.

> Starting the migration from version: 5020
> Role / permission map imported.
> Control panel imported.
> Archetype tool imported.
> Interface Products.ResourceRegistries.interfaces.settings.IResourceRegistriesSettings specified for record %s has no field plone.lessvariables.
> Ran upgrade step: Run to51alpha1 upgrade profile.
> Role / permission map imported.
> Archetype tool imported.
> Removed record plone.resources/mockup-registry.init.
> Removed record plone.resources/mockup-registry.export.
> Removed record plone.resources/mockup-registry.deps.
> Removed record plone.resources/mockup-registry.conf.
> Removed record plone.resources/mockup-registry.url.
> Removed record plone.resources/mockup-registry.css.
> Removed record plone.resources/mockup-registry.js.
> Removed record plone.resources/mockup-parser.init.
> Removed record plone.resources/mockup-parser.export.
> Removed record plone.resources/mockup-parser.deps.
> Removed record plone.resources/mockup-parser.conf.
> Removed record plone.resources/mockup-parser.url.
> Removed record plone.resources/mockup-parser.css.
> Removed record plone.resources/mockup-parser.js.
> Ran upgrade step: Run to51alpha2 upgrade profile.
> Role / permission map imported.
> Toolset imported.
> Archetype tool imported.
> Ran upgrade step: Run to51beta1 upgrade profile.
> Added 'sort_on' property to site_properties.
> Ran upgrade step: Add default search options
> Removed no longer existing path mimetypes_icons from skin selection Plone Default.
> Removed no longer existing path PasswordReset from skin selection Plone Default.
> Removed no longer existing path plone_ecmascript from skin selection Plone Default.
> Removed no longer existing path plone_content from skin selection Plone Default.
> Removed no longer existing path mimetypes_icons from skin selection Old Plone 3 Custom Theme.
> Removed no longer existing path cmfeditions_views from skin selection Old Plone 3 Custom Theme.
> Removed no longer existing path PasswordReset from skin selection Old Plone 3 Custom Theme.
> Removed no longer existing path plone_ecmascript from skin selection Old Plone 3 Custom Theme.
> Removed no longer existing path plone_content from skin selection Old Plone 3 Custom Theme.
> Removed no longer existing path mimetypes_icons from skin selection skin2.
> Removed no longer existing path cmfeditions_views from skin selection skin2.
> Removed no longer existing path PasswordReset from skin selection skin2.
> Removed no longer existing path plone_ecmascript from skin selection skin2.
> Removed no longer existing path plone_content from skin selection skin2.
> Removed no longer existing path mimetypes_icons from skin selection Sunburst Theme.
> Removed no longer existing path cmfeditions_views from skin selection Sunburst Theme.
> Removed no longer existing path PasswordReset from skin selection Sunburst Theme.
> Removed no longer existing path plone_ecmascript from skin selection Sunburst Theme.
> Removed no longer existing path plone_content from skin selection Sunburst Theme.
> Ran upgrade step: Remove skins layer converted to browser resources
> Ran upgrade step: Remove jquery.cookie from plone-logged-in stub_js_modules
> Role / permission map imported.
> Toolset imported.
> Archetype tool imported.
> Ran upgrade step: Run to51beta1 upgrade profile.
> Removed object/displayContentsTab from action at /Main/portal_actions/object/folderContents
> Ran upgrade step: Remove displayContentsTab from action expressions
> Ran upgrade step: Miscellaneous
> Role / permission map imported.
> Archetype tool imported.
> Ran upgrade step: Run to51beta3 upgrade profile.
> Role / permission map imported.
> Archetype tool imported.
> Removed record plone.resources/tinymce-layer.init.
> Removed record plone.resources/tinymce-layer.export.
> Removed record plone.resources/tinymce-layer.deps.
> Removed record plone.resources/tinymce-layer.conf.
> Removed record plone.resources/tinymce-layer.url.
> Removed record plone.resources/tinymce-layer.css.
> Removed record plone.resources/tinymce-layer.js.
> Catalog imported.
> Field types updated on social media schema
> Ran upgrade step: Update social media fields
> Role / permission map imported.
> Archetype tool imported.
> Removed record plone.resources/tinymce-layer.init.
> Removed record plone.resources/tinymce-layer.export.
> Removed record plone.resources/tinymce-layer.deps.
> Removed record plone.resources/tinymce-layer.conf.
> Removed record plone.resources/tinymce-layer.url.
> Removed record plone.resources/tinymce-layer.css.
> Removed record plone.resources/tinymce-layer.js.
> Catalog imported.
> Ran upgrade step: Run to51beta4 upgrade profile.
> Ran upgrade step: Fix double shared maxage
> Reindexed `mime_type` for 339 items
> Ran upgrade step: Reindex mime_type
> Role / permission map imported.
> Actions tool imported.
> Archetype tool imported.
> Ran upgrade step: Run to51rc1 upgrade profile.
> Ran upgrade step: Move safe_html settings from portal_transforms to Plone registry
> Ran upgrade step: Cleanup duplicate settings from placefiul workflow from Plone registry
> Ran upgrade step: Remove registration of p.a.c import_steps since they were transformed into post_handlers
> Ran upgrade step: Miscellaneous
> Role / permission map imported.
> Archetype tool imported.
> Ran upgrade step: Run to511 upgrade profile.
> Role / permission map imported.
> Archetype tool imported.
> Ran upgrade step: Run to512 upgrade profile.
> Action object/ical_import_enable was not found
> Action object/ical_import_disable was not found
> Ran upgrade step: Update an action i18n domain
> Role / permission map imported.
> Archetype tool imported.
> Removed record plone.resources/resource-plone-app-event-js.init.
> Removed record plone.resources/resource-plone-app-event-js.export.
> Removed record plone.resources/resource-plone-app-event-js.deps.
> Removed record plone.resources/resource-plone-app-event-js.conf.
> Removed record plone.resources/resource-plone-app-event-js.url.
> Removed record plone.resources/resource-plone-app-event-js.css.
> Removed record plone.resources/resource-plone-app-event-js.js.
> Removed record plone.resources/resource-plone-app-event-css.init.
> Removed record plone.resources/resource-plone-app-event-css.export.
> Removed record plone.resources/resource-plone-app-event-css.deps.
> Removed record plone.resources/resource-plone-app-event-css.conf.
> Removed record plone.resources/resource-plone-app-event-css.url.
> Removed record plone.resources/resource-plone-app-event-css.css.
> Removed record plone.resources/resource-plone-app-event-css.js.
> Ran upgrade step: Run to513 upgrade profile.
> Ran upgrade step: Force remove old p.a.event resources
> Role / permission map imported.
> Skins tool imported.
> Archetype tool imported.
> Removed record plone.resources/jquery-highlightsearchterms.init.
> Removed record plone.resources/jquery-highlightsearchterms.export.
> Removed record plone.resources/jquery-highlightsearchterms.deps.
> Removed record plone.resources/jquery-highlightsearchterms.conf.
> Removed record plone.resources/jquery-highlightsearchterms.url.
> Removed record plone.resources/jquery-highlightsearchterms.css.
> Removed record plone.resources/jquery-highlightsearchterms.js.
> Ran upgrade step: Run to514 upgrade profile.
> Ran upgrade step: Miscellaneous
> Ran upgrade step: Miscellaneous
> End of upgrade path, main migration has finished.
> Starting upgrade of core addons.
> Done upgrading core addons.
> Your Plone instance is now up-to-date.

Products.ZCatatlog used to have a simple TextIndex for word indexing. Meanwhile, it has been dropped in favor of the more sophisticated ZCTextIndex. I suppose that your storage still contains instances of the old TextIndex class and that there is no longer backing code -- consequently, no getId.

At your place, I would check the catalog's indexes and if you find old TextIndexes, replace them with ZCTextIndexes, then reindex the replaced indexes.

3 Likes

@dieter Thank you very much for the help.

I found that the Creating An Index Through The Web documentation tells how to view the index. I found that “Description” and “Title” both had “Index Type” of “ZCatalogIndex” with “n/a” as the number of distinct values. Reindexing on these two generates the

AttributeError("'TextIndex' object has no attribute '__of__'",) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: 'TextIndex' object has no attribute 'getId')

message. This is similar to the error message that I was seeing before. I used the “Remove index” button at the bottom of the Indexes tab page to remove the “Description” and “Title” indices and then used the “Add” button to add in “Description” and “Title” indices using the ZCTextIndex type. I left the “Indexed attributes” field blank and used the default Ranking Strategy and Lexicon settings of “Cosine Measure” and plone_lexicon and reindexed them.

The site now loads and looks fine. Thanks!!!

I see that the “getObjPositionInParent” index has type “GopipIndex” with “n/a” number of distinct values. Should I replace it too? If so, which index type should I use?

Again, thanks for the help. I really appreciate it.

I did a migration from 4.3py2 to 5.2py3 too and found the package GitHub - collective/collective.migrationhelpers: Some helpers and examples to use during migrations very useful on some tasks ... maybe worth a look (especially the post python3 modulecollective.migrationhelpers/post_python3_fixes.py at master · collective/collective.migrationhelpers · GitHub) ... but I didn't get your traceback to be honest ...

No. Some indexes have a complex internal structure and therefore do not have meaningful "size" information; they show "n/a" for "number of distinct values". By itself, this is not an indication that the index should get replaced.

1 Like

Thank you @dieter. Good to know. I will leave the GopipIndex index as it is.

@petschki I have looked at the GitHub - collective/collective.migrationhelpers: Some helpers and examples to use during migrations helpers and have not figured out how to use them. The documentation that I have found describes them but does not give examples on how to use them. Can you give me an example that shows how to use post_python3_fixes.py or direct me to an example that I could use to learn how to use the helpers?

Thanks, Michael

There's no UI or views for migrating stuff in this package. Just a bunch of best practices/hints which you can either copy&paste or import in your own migration BrowserView / instance run-script.