1

I have an entry about the U.K. TV show "Being Human". If I search "being" on the back end, it comes up with 0 results, same on the front end search.

Searching for "Human" brings it up, but "Being Human" does not.

Doe the default "title" field not get indexed by search? How can I enable it if so?

1

Try to specify the fields you need to search.

{% set queryParams = {
        search: {
            query: 'title:*' ~ name ~ '* OR description:*' ~ name ~ '* OR previewText:*' ~ name ~ '* OR tag:*' ~ name ~ '*'
        }
    } %}

{% set entries = craft.entries(queryParams).section('entries').all() %}
3
  • Based on your reply, I tried {% set queryParams = { search: { query: 'title:*' ~ searchQuery ~ '* OR mediaDescription:*' ~ searchQuery ~ '*' } } %} {% set entries = craft.entries(queryParams).search(searchQuery).section('tv, movies, documentaries').orderBy('score').all() %} but it's still not returning results.
    – MarkD
    Jul 16 '20 at 7:56
  • But this worked... {% set queryParams = { search: { query: 'title:*' ~ searchQuery ~ '* OR mediaDescription:*' ~ searchQuery ~ '*' } } %} {% set entries = craft.entries(queryParams).section('tv, movie, documentaries').orderBy('score').all() %}
    – MarkD
    Jul 16 '20 at 8:01
  • 1
    @MarkD not returning result, because we call method search, when add it in hash queryParams. Jul 16 '20 at 8:11
1

"being" is a MyISAM full-text search stopword by default (meaning MySQL will ignore it for full text searches).

https://dev.mysql.com/doc/refman/8.0/en/fulltext-stopwords.html

If you're on MySQL 5.6+, you can convert Craft's searchindex table to InnoDB (where it's not a stopword), or you can edit your MySQL's config stop word list to exclude that word.

Your Answer

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

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