Hi,
I created a form in a page template for a Dexterity content type, which searches for projects inside the site, that hits a category, a product version and should be sorted by rating or newest ones.
Here is the code for the search form inside the page template:
Show All categories Any version Sort On Featured items are sorted by rating Highest Rated NewestNo results were found.
234 projects matching your criteria.
-
Product One
<span i18n:translate="">in</span> <span tal:replace="python:', '.join(result.getObject().category_choice)"></span> </span> <p class="product-description" tal:content="structure project/description"> <tal:comment replace="nothing">Project Description.</tal:comment> </p> </div> <div class="visualClear" ></div> </tal:entry> </li> </ul> <div metal:use-macro="here/batch_macros/macros/navigation" /> </tal:results>
The form uses a function inside the view of the dexterity content type, that make a search in the portal_catalog:
def get_products(self, category, version, sort_on, SearchableText=None): self.catalog = api.portal.get_tool(name='portal_catalog') # sort_on = 'positive_ratings' if SearchableText: SearchableText = self.munge_search_term(SearchableText) contentFilter = { 'sort_on': sort_on, 'SearchableText': SearchableText, 'sort_order': 'reverse', 'portal_type': 'collective.templates.tlproject', } if version != 'any': contentFilter['getCompatibility'] = version if category: contentFilter['getCategories'] = category try: return self.catalog(**contentFilter) except ParseError: return []
This form works nicely in Plone up to version 5.1, but the search gives no results for Plone 5.2, independently if it runs on Python 2.7 or 3.6.
If I perform a search putting a string into the text search field I get a proper result (the project(s) with the matching name(s)).
Is there a change for working with page templates in Plone 5.2, which breaks the backward compatibility? Or did I run into a bug?
Thanks for any hint in advance.
Kind regards,
Andreas