Answers.Body: <p>You could use the Twig functions <code>merge</code> and <code>default</code> to merge the two sets of entries.</p>
  
  <pre><code>{% set entries = craft.entries.search(query).order('score')|default([]) %}
  {% set authors = craft.users.search('fullName:*' ~ query ~ '*')|default([]) %}
  
  {% if authors %}
      {% set results = entries|merge(authorArticles) %}
  {% endif %}
  
  &lt;p&gt;
      You have {{ results|length }} {{ results|length == 1 ? 'result' : 'results' }}.
  &lt;/p&gt;
  </code></pre>
  
  <p>The <code>default</code> function is a handy stand-in for short circuit evaluation in twig, so that you can be sure to at least pass an empty array to <code>merge</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-30T21:34:59.997Z
Answers.LastActivityDate: 2014-11-30T21:34:59.997Z
Answers.UserDisplayName: Brian Whitton
Body: <p>I've got a site-wide search box (based on the example in the documentation). It's doing a good job of searching through the entries, but is there a way that I can include a search through a user group like authors as well and include it in the same list of results? </p>
  
  <p>Currently I just have this but its not getting any results for author searches even though I know they exist. It seems like the authors should be searchable since they're linked to the entry...</p>
  
  <pre><code>{% set entries = craft.entries.search(query).order('score') %}
  </code></pre>
  
  <p>If I did another search through <code>craft.users.search</code> I could get another list of results, but I'd like to have one combined list. Is something like that possible?</p>
  
Tags: <users><search><author>
Title: Including author in search for entries
ThreadText: # Including author in search for entries
  
  (Asked by: username_0 on 2014-11-05)
  
  I've got a site-wide search box (based on the example in the documentation). It's doing a good job of searching through the entries, but is there a way that I can include a search through a user group like authors as well and include it in the same list of results?
  
  Currently I just have this but its not getting any results for author searches even though I know they exist. It seems like the authors should be searchable since they're linked to the entry...
  
  ```
  {% set entries = craft.entries.search(query).order('score') %}
  
  ```
  
  If I did another search through `craft.users.search` I could get another list of results, but I'd like to have one combined list. Is something like that possible?
  
  **Tags:** users, search, author
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-11-30. Score: 3 | Accepted answer
  
  You could use the Twig functions `merge` and `default` to merge the two sets of entries.
  
  ```
  {% set entries = craft.entries.search(query).order('score')|default([]) %}
  {% set authors = craft.users.search('fullName:*' ~ query ~ '*')|default([]) %}
  
  {% if authors %}
      {% set results = entries|merge(authorArticles) %}
  {% endif %}
  
  <p>
      You have {{ results|length }} {{ results|length == 1 ? 'result' : 'results' }}.
  </p>
  
  ```
  
  The `default` function is a handy stand-in for short circuit evaluation in twig, so that you can be sure to at least pass an empty array to `merge`.
  
  
  ---
  
  