collective / collective.solr

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

Add SolrControlpanelAdapter for Volto support (not working yet) #290

Closed tisto closed 2 years ago

sneridagh commented 2 years ago

@tisto Turns out that the adapter registration should match the controlpanel.xml settings:

  <configlet
    title="Solr Settings"
    action_id="SolrSettings"
    appId="SolrSettings"
    category="Products"
    condition_expr=""
    icon_expr="string:${portal_url}/++resource++collective.solr.images/icon.png"
    url_expr="string:${portal_url}/@@solr-controlpanel"
    visible="True"
    i18n:attributes="title">
     <permission>Manage portal</permission>
  </configlet>
<registry>
  <records interface="collective.solr.interfaces.ISolrSchema"
           prefix="collective.solr">
</registry>

the appId and the action_id are (don't know if should) be the same and maps to the configlet_id. The category maps to the configlet_category_id. The prefix is set in the registry.xml for the interface. So the adapter should be configured to match them:

@adapter(Interface, Interface)
class SolrControlpanelAdapter(RegistryConfigletPanel):
    schema = ISolrSchema
    configlet_id = "SolrSettings"
    configlet_category_id = "Products"
    schema_prefix = "collective.solr"