Skip to content

Commit

Permalink
fix upgrade-step
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Jan 15, 2025
1 parent aeb0105 commit 9747619
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/rer/solrpush/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<version>3100</version>
<version>3200</version>
<dependencies>
<dependency>profile-collective.z3cform.jsonwidget:default</dependency>
<dependency>profile-plone.restapi:default</dependency>
Expand Down
6 changes: 4 additions & 2 deletions src/rer/solrpush/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ def to_3000(context):
init_solr_push()


def to_3100(context):
def to_3200(context):
"""
Remove unused behavior and reindex items
"""
types_tool = api.portal.get_tool(name="portal_types")
for ptype in types_tool.listTypeInfo():
behaviors = ptype.behaviors
behaviors = getattr(ptype, "behaviors", None)
if not behaviors:
continue
if "rer.solrpush.behaviors.solr_fields.ISolrFields" in behaviors:
behaviors = list(behaviors)
behaviors.remove("rer.solrpush.behaviors.solr_fields.ISolrFields")
Expand Down
8 changes: 8 additions & 0 deletions src/rer/solrpush/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,12 @@
destination="3100"
handler=".upgrades.update_rolemap"
/>
<genericsetup:upgradeStep
title="Remove unused behavior and reindex items"
description=""
profile="rer.solrpush:default"
source="3100"
destination="3200"
handler=".upgrades.to_3200"
/>
</configure>
6 changes: 4 additions & 2 deletions src/rer/solrpush/utils/solr_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ def can_index(item):
return False
if not is_right_portal_type(item):
return False
# if not getattr(item, "showinsearch", True):
# return False
if (
getattr(item, "exclude_from_search", None) is False
): # this comes with a design.plone.contenttypes behavior
return False
return True


Expand Down

0 comments on commit 9747619

Please sign in to comment.