collective / collective.solr

Solr search engine integration for Plone
https://pypi.org/project/collective.solr/
21 stars 46 forks source link

Missing upgrade step? #346

Open gforcada opened 1 year ago

gforcada commented 1 year ago

We are using 8.0.0b1 (with a few patches on top) and when trying to upgrade to latest stable (8.4.2) we are getting the usual KeyError from plone.registry as prefix_wildcard option was added on #271.

As there is no upgrade step, when one updates their website with a newer version of c.solr all usages of Solr are broken until one manually creates the record 😕

Since #271 is already 2 and a half years old and it has been in a release since 8.2.0 I guess this is way too old news? 🤔

Testing it locally one can create a fake record prior to upgrading to +8.2.0:

from plone import api
from plone.registry import Record
from plone.registry.field import Bool

registry = api.portal.get_tool('portal_registry')
key = 'collective.solr.prefix_wildcard'  # the registry has a prefix, see https://github.com/collective/collective.solr/blob/main/src/collective/solr/profiles/default/registry.xml#L3
registry.records[key] = Record(Bool(title=''), False)

After running this, one can then safely update to +8.2.0 🎉

gforcada commented 1 year ago

Actually, after testing, it is not only prefix_wildcard but also, in our case, force_simple_search and allow_complex_search 😅

adrianschulz commented 1 year ago

Same here. But luckily this is easy to fix with manually adding the records.

I don't know how to handle this since the change was long ago.

tisto commented 1 year ago

Crap. I wasn't aware of this. We could create an upgrade step in the 8.x.x series to fix this.