Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd computed metadata to catalog for dexterity object (plone 4)
    text
    copied!<p>I want to create a catalog metadata with a computed string. So following <a href="https://www.packtpub.com/professional-plone-4-development/book" rel="nofollow">Aspeli's book</a> and <a href="http://plone.org/documentation/manual/developer-manual/indexing-and-searching/custom-indexing-strategies" rel="nofollow">the developer manual</a> I proceeded to create an indexer:</p> <pre class="lang-py prettyprint-override"><code># indexer.py @grok.adapter(Entry, name='bind_representation') @indexer(Entry) def bindIndexer(context): print str(IBindRepresentable(context)) return str(IBindRepresentable(context)) </code></pre> <p>and register the index with genericSetup:</p> <pre class="lang-xml prettyprint-override"><code>&lt;!-- profiles/default/catalog.xml --&gt; &lt;?xml version="1.0"?&gt; &lt;object name="portal_catalog" meta_type="Plone Catalog Tool"&gt; &lt;index name="bind_representation" meta_type="ZCTextIndex"&gt; &lt;!-- I tried with meta_type="FieldIndex" too --&gt; &lt;indexed_attr value="bind_representation"/&gt; &lt;!-- copied from other text metadata --&gt; &lt;extra name="index_type" value="Okapi BM25 Rank"/&gt; &lt;extra name="lexicon_id" value="plaintext_lexicon"/&gt; &lt;/index&gt; &lt;/object&gt; </code></pre> <p>The problems are: (1) only the index is registered, not the metadata, and (2) After reindex all the zodb, bind_representation still doesn't find any entry to index, even when they are.</p> <p>The examples cited only deal with pre-existent indexes, so I'm not sure about the content of catalog.xml. <strong>bindIndexer</strong> seems not to be called at all, since its print statement is never executed. I copied <strong>bindIndexer</strong> to entry.py too, to get sure it wasn't being ignored, but still nothing.</p> <p>What am I missing?</p> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload