开发者

How to make RichTextValue catalog full text search for Plone 4

I created dexterity content type with Rich Text Field - "body text". I'd like to make "body text" full text searchable for my Plone 4.0.2.

I added catalog.xml in my theme, code below

I got error mes开发者_C百科sage from ZMI/portal/portal_catalog "body_text RichTextValue object. (Did you mean .raw or .output?) "

How can I change catalog.xml to use .output, I tried , but it doesn't work.

Thanks.


You could use plone.indexer and provide your own indexer inside your dexterity type to add your custom body text to the SearchableText index (including default title and description for example) like so:

@indexer(IMyTypeInterface)
def SearchableText(obj):
    return ' '.join([obj.Title(), obj.Description(), obj.bodytext.output])


Disclaimer: I have not encountered this issue myself, so this is just a guess.

Archetypes and others use SearchableText() index/accessor to populate the full text search index for Plone search.

You probably need to add SearchableText() method to your content type and make it return all the text concatenated which you want full text search to pick up.


Christoph's suggestion of a custom indexer is a good one. You can also use this add-on: collective.dexteritytextindexer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜