Answers.Body: <p>You're getting that error because as soon as you call <code>find()</code>, you're converting the <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel" rel="nofollow">ElementCriteriaModel</a> into an array of <a href="https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements">actual fetched elements</a> and the <a href="http://buildwithcraft.com/docs/templating/paginate#parameters" rel="nofollow">{% paginate %}</a> tag requires an ElementCriteriaModel object to be passed in.</p>
  
  <p>In order to pull off what you're looking for, you'd need to ability to search across multiple element types in one query, which is currently not something Craft supports.</p>
  
  <p>Consider voting for this <a href="http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9505794-all-search-to-work-across-element-types-particul" rel="nofollow">feature request</a>, which would enable what you're trying to do.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-21T00:58:37.540Z
Answers.Text: Thanks of letting me know. 
  
  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.
Answers.UserDisplayName: Edin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-20T18:58:49.423Z
Answers.LastActivityDate: 2015-10-20T18:58:49.423Z
Answers.UserDisplayName: Brad Bell
Body: <p>I need to search both entries and assets and paginate the combined result.</p>
  
  <p>I have tried:</p>
  
  <pre><code>{% 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) %}
  </code></pre>
  
  <p>But then I can't get paginate to work:</p>
  
  <pre><code>{% paginate searchResults as results %}
  </code></pre>
  
  <p>... brings up the following error:</p>
  
  <blockquote>
    <p>Argument 1 passed to Craft\TemplateHelper::paginateCriteria() must be an instance of Craft\ElementCriteriaModel, array given</p>
  </blockquote>
  
  <p>If I don't use a <code>.find()</code>, I can't merge the two objects.</p>
  
  <p>Any ideas how this can be achieved?</p>
  
Tags: <entries><assets><search><pagination>
Title: Search across Entries and Assets and paginate combined results
ThreadText: # Search across Entries and Assets and paginate combined results
  
  (Asked by: username_0 on 2015-10-20)
  
  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?
  
  **Tags:** entries, assets, search, pagination
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-20. Score: 1 | Accepted answer
  
  You're getting that error because as soon as you call `find()`, you're converting the [ElementCriteriaModel](http://buildwithcraft.com/docs/templating/elementcriteriamodel) into an array of [actual fetched elements](https://craftcms.stackexchange.com/questions/265/what-are-the-differences-between-an-elementcriteriamodel-and-fetched-elements) and the [{% paginate %}](http://buildwithcraft.com/docs/templating/paginate#parameters) tag requires an ElementCriteriaModel object to be passed in.
  
  In order to pull off what you're looking for, you'd need to ability to search across multiple element types in one query, which is currently not something Craft supports.
  
  Consider voting for this [feature request](http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/9505794-all-search-to-work-across-element-types-particul), which would enable what you're trying to do.
  
  > **Comments:**
  > **username_0**: Thanks of letting me know.   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.  
  
  ---
  
  