2

I'm building a site and getting some odd search results.

For example, searching against the term 'Gibraltar' returns an entry with four mentions of the term in it's content first, whilst an entry with 'Gibraltar' in the title and 10 instances in the body is returned second.

I am returning the results paginated, ie:

{% paginate craft.entries.search( '*' ~ query ~ '*' ).limit(10).order('score') as entries %}

Any thoughts why this might be happening? I came across this issue reported last year at Search order "Score" criteria - seems to be the same issue.

Cole

  • Of the top of my head: shouldn't it be .order('score DESC'), because you want the highest score first? – Paul Nov 16 '15 at 15:52
  • Hmm, according to the docs, it shouldn't :) – Paul Nov 16 '15 at 15:53
  • Thanks @PaulVerheul - had tried that but throws an error – Cole Henley Nov 17 '15 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.