I am trying to improve the performance of our site search. I'm wondering if there is anything I can implement that may speed things up. Currently we have a search being sent to a results page. In the results page we have this call to the database.

{% set entries = craft.entries.search(query).order('score') %}

query is returned from the q parameter in the url.

We are using a matrix field for all the main content blocks on the site. This field has 10 block types with a max of 7 fields in each. This is used on all entries across the site.

Looking at the profiler after running a query on a phrase that is very popular across the site it takes around 11s and queries the db 500+ times.

Any suggestions how we may reduce this time down? Or is this just a disadvantage of using matrix fields?

1 Answer 1


Have you looked into eager loading the Matrix field if you are on 2.6? This should vastly cut down on the number of queries needed.

The other thought could be to use the Preparse field plugin to push the matrix fields into simple text, and then direct the search query to only look at the title field and preparse fields.

  • thanks will have a look at it. Will need to upgrade to 2.6 first but looks like it will be worth the effort. Cheers
    – Lettie
    Commented Mar 29, 2016 at 14:03

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.