Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have problems to understand the difference between search and relatedTo. From my understanding, this is a fulltext search on all fields.

{% set entries ='score') %}

Does the following approach mean the same?

{% set entries = craft.entries.relatedTo(test).order('score').find() %}

And if yes, which one delivers the better performance?


share|improve this question
up vote 7 down vote accepted

To be honest, those two parameters may seem to be slightly similar but provide a totally different functionality.

From their documentation on search:


Only fetch entries that match a given search query. (See Searching for the syntax and > available search attributes.)

Which means whatever you pass in .search(query), and there is a rather complex list here, will actually 'search' Craft for the query string you specify.

On a different note,


Only fetch entries that are related to certain other elements. (See Relations for the syntax options.)

This on the other hand only 'relates' to other entries, meaning its not performing a fill search on Craft, only the entries. A detailed reference on relations can be found here.

As far as performance, the two are unrelated as it really depends on what you are trying to accomplish.

Hope this clears it up for you!

share|improve this answer
Using search is going to be slower in about 99% of the cases as it's doing a MySQL Full Text Search (, an inherently slow operation. – Brad Bell Jul 25 '14 at 17:03
Excellent point Brad. – Jason McCallister Jul 25 '14 at 17:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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