在 Plone 5 中添加用于 collections 排序的自定义索引

Adding custom index for sorting of collections in Plone 5

为了根据用户给予的正面评价数量对我的 plone 页面进行排名,我正在使用 cioppino.twothumbs 插件,现在想根据正面评价的数量对 collection 进行排序.

我想从 Plone 5 插件添加自定义索引 cioppino.twothumbs as sortable index to Plone collections. The index is called positive_ratings and registered by catalog.xml of cioppino.twothumbs. In my custom branch of the addon I added the code mentioned in the documentation:

<records interface="plone.app.querystring.interfaces.IQueryField"
       prefix="plone.app.querystring.field.positive_ratings">
<value key="title">Positive Ratings</value>
<value key="description">total number of positive ratings</value>
<value key="enabled">False</value>
<value key="sortable">True</value>
<value key="operations">
</value>
<value key="group">Metadata</value>

到插件的 registry.xml。不幸的是,我的索引在 添加 Collection 页面上不可见,尽管它可作为 Collection.

的附加列使用

此问题类似于 this one,但与那里的用户不同,我没有修改 plone.app.querystring 源代码,而是修改了 cioppino.twothumbs 的自定义分支,如答案所建议的.

代码完全正确,但是我忘记重新运行插件的安装以更新注册表。这完全解决了问题,并启用了按此值对集合进行排序。