I assume that in plain text I can use spaces for string concatenation. But when I expose it in SearchableText(), how should I preprocess the HTML content?
from Products.CMFCore.utils import getToolByName
transforms = getToolByName(self.context,'portal_transforms')
stream = transforms.convertTo('text/plain', html, mimetype='text/html')
text = stream. getData().strip()
In order to index fields in smart, I recommend using collective.dexteritytextindexer (but currently there is no TTW support).
–> http://pypi.python.org/pypi /collective.dexteritytextindexer
–> https://github.com/collective/collective.dexteritytextindexer
Cheers
I am writing a Dexterity The content type, which contains plain text and HTML fields. I want to have a custom SearchableText() method that exposes these fields to portal_catalog and Plone full text search.
I assume plain text I You can use spaces for string concatenation. But when I expose it in SearchableText(), how should I preprocess the HTML content?
In order to transform data in plone, there is a tool called portal_transforms, which is very smart in transforming content (depending on your operating system/installation, It may also be able to convert .doc, .pdf, etc.):
from Products.CMFCore.utils import getToolByName
transforms = getToolByName(self.context, 'portal_transforms')
stream = transforms.convertTo('text/plain', html, mimetype='text/html')
text = stream.getData().strip()
< p>In order to index fields in smart, I recommend using collective.dexteritytextindexer (but currently there is no TTW support).
-> http://pypi.python.org/pypi/collective.dexteritytextindexer
-> https:/ /github.com/collective/collective.dexteritytextindexer
Cheers