<p>Difficult, if not impossible, to do accurately in Craft 2.4.</p>

<p>In the upcoming <a href="http://buildwithcraft.com/beta" rel="nofollow">Craft 2.5</a>, the actual search score is being returned in the results, so you'd be able to take the two arrays, merge and sort them via their score into one result-set.</p>

CC BY-SA 3.0
2015-11-17T18:24:14.450Z
2015-11-17T18:24:14.450Z
Brad Bell
<p>I'm trying to display three different sets of data in search results. The first two, News and Services I can easily concatenate by the following:</p>

<pre><code>{% set searchSections =  craft.entries.section(['service', 'newsOpinion']) %}
{% for entry in searchSections.search(query).order('score').limit(52).find()  %}
</code></pre>

<p>This way the results display both sections limited and ordered via score no matter what section they are in.</p>

<p>Ideally I want to add a third array to searchSections of users.</p>

<pre><code>{% set allStaff = craft.users.group('staff') %}
{% for user in allStaff.search(query).order('score').limit(52).find() %}
</code></pre>

<p>However users aren't a section and merging the three arrays doesn't work. Any ideas how i can do this?</p>

<users><search><forloop>
How to add users to the search results?
# How to add users to the search results?

(Asked by: username_0 on 2015-11-17)

I'm trying to display three different sets of data in search results. The first two, News and Services I can easily concatenate by the following:
{% set searchSections =  craft.entries.section(['service', 'newsOpinion']) %}
{% for entry in searchSections.search(query).order('score').limit(52).find()  %}

This way the results display both sections limited and ordered via score no matter what section they are in.
Ideally I want to add a third array to searchSections of users.
{% set allStaff = craft.users.group('staff') %}
{% for user in allStaff.search(query).order('score').limit(52).find() %}

However users aren't a section and merging the three arrays doesn't work. Any ideas how i can do this?

**Tags:** users, search, forloop

---

## 1 answers

### Answer by username_1 on 2015-11-17. Score: 1 | Accepted answer

Difficult, if not impossible, to do accurately in Craft 2.4.

In the upcoming [Craft 2.5](http://buildwithcraft.com/beta), the actual search score is being returned in the results, so you'd be able to take the two arrays, merge and sort them via their score into one result-set.


---

