Plone 5.2-rc5 - Issue with a search form


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 Newest  

No 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>
                                                 <p class="product-description"
                                                         tal:content="structure project/description">
                                                     <tal:comment replace="nothing">Project Description.</tal:comment>
                                             <div class="visualClear" ></div>
                                 <div metal:use-macro="here/batch_macros/macros/navigation" />

    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
            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,

Well, you have to debug this yourself. Look at your query parameters and see which one of the parameter may cause the problem. You start to query with one parameter and check the result. Then add one parameter after another and check the results in order to understand what may cause the problem. Or check a catalog search with one parameter at a time (except the sort stuff) and see if one returns no results. Since all subqueries are combined using AND, you may find your problem quickly.

Apart from that: search_order was always descending | ascending

Thanks for the hint.
I played further with the search form and could fix the issue. The problem was caused by an empty field for the search string. The portal_catalog search with 'SearchableText' failed in that case. Added an alternative search for an empty string to the function.