I need to search both entries and assets and paginate the combined result.
I have tried:
{% set entries = craft.entries.search(query|trim).order('score').status('pending, live').find() %}
{% set assets = craft.assets.source('documentLibrary').search(query).find() %}
{% set searchResults = entries | merge(assets) %}
But then I can't get paginate to work:
{% paginate searchResults as results %}
... brings up the following error:
Argument 1 passed to Craft\TemplateHelper::paginateCriteria() must be an instance of Craft\ElementCriteriaModel, array given
If I don't use a .find(), I can't merge the two objects.
Any ideas how this can be achieved?
The only way I've managed to do this is by creating a specific channel and assigning an asset to an entry. It adds an extra step in the process but it's a feature we need for the website.
– Edin Oct 21 '15 at 00:58