Search control panel unreachable due to missing sort_on field

In one of our Plone installations running 4.3.12, the Search control panel is unavailable.

When we try to access it, we get the "Something went wrong" screen, behind which is this error message:

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 zope.formlib.form, line 868, in __call__
  Module five.formlib.formbase, line 50, in update
  Module zope.formlib.form, line 831, in update
  Module plone.fieldsets.form, line 21, in setUpWidgets
  Module zope.formlib.form, line 417, in setUpEditWidgets
  Module zope.schema._bootstrapfields, line 215, in get
  Module plone.app.controlpanel.search, line 116, in sort_on
AttributeError: sort_on

My first impulse is to "work around" this by loading the search control panel and setting the field from Python, but loading the debugger, I fail to retrieve the search control panel for precisely the same reason:

>>> registry = getUtility(IRegistry, context=ps)
>>> search_settings = registry.forInterface(ISearchSchema, prefix='plone')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/dsn/dsn.dk/eggs/plone.registry-1.0.5-py2.7.egg/plone/registry/registry.py", line 78, in forInterface
    name
KeyError: 'Interface `plone.app.controlpanel.search.ISearchSchema` defines a field `sort_on`, for which there is no record.'

I'm guessing the upgrade to 4.3.12 may have failed without us noticing, but are there any suggestions as how I may remedy this now that apparently it wasn't possible to fix "behind the scenes" like I tried to?

And might an upgrade to 4.3.14 (which we should do anyway before too long) solve the problem?

Thanks in advance for any response. :slight_smile:

this is the upgrade step that should take care of this:

but seems the problem is the registry and not the property:

@rodfersou do you mind to take a look on this? we never got into this issue.

Talking of "sort_on"...we receive an error

'CatalogError: Unknown sort_on index (relevance)'

after upgrading to Plone 4.3.15.

Expression: "python: [i for i in feed.items]"\n - Filename: ... cts/CMFPlone/browser/syndication/templates/search-rss.pt\n - Location: (line 12: col 29)\n - Source: objects python: [i for i in feed.items];

Any idea?

@zopyx you may have found a corner case because this template has not being touched in eons.

do you mind to open an issue on GitHub?

@agger here's the whole commit for the upgrade step; you may have found a bug:

if you are able to reproduce it give us instructions on a new issue on GitHub so we can work on it.

Thanks for your responses, I'll look into it later today! First of all, I need to check if the ZODB was properly upgraded after the last Plone upgrade (to 4.3.12). If it was, and I can reproduce the issue, I'll create an issue.

I saw Andreas filed https://github.com/plone/Products.CMFPlone/issues/2247 but I think it's the same issue I filed at https://github.com/plone/Products.CMFPlone/issues/2060 which @hvelarde and I discussed in Unknown sort_on index (relevance)

1 Like

Now it is my time to get bitten by this..
PR: https://github.com/plone/plone.restapi/pull/862
Travis: https://travis-ci.org/github/plone/plone.restapi/jobs/668644894#L384

Don't get why can't find the field, it is there: https://github.com/plone/plone.app.controlpanel/blob/2.3.11/plone/app/controlpanel/search.py#L59-L65

@agger do you remember how you fix this?