Cherry picked https://github.com/plone/plone.app.search/pull/6 from master branch to 1.0.x