TransWikia.com

Search not searching certain words - how to fix?

Craft CMS Asked by MarkD on September 4, 2021

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?

2 Answers

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() %}

Correct answer by Pavel Pavlovich on September 4, 2021

"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.

Answered by Brad Bell on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP