1

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?

1 Answer 1

1

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

In the upcoming Craft 2.5, 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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.