2

When I search for titles of entries in the Craft control panel, I get odd results:

I have an entry called Fake Story about the Economy.

If I search for that exact title, I get no results.

If I search for Fake Story about, I get no results.

If I search for Fake Story, the entry Fake Story about the Economy is returned.

If I search for Fake Story the Economy, the entry Fake Story about the Economy is returned.

The results are similar for other entries in that channel. For example, I have an entry called Is it still business as usual?. The only way I can find it is if I leave out the word still when I type it (Is it business as usual?).

Other channels seem to be working fine.

This is of course affecting my ability to build a working search form on the front end as well.

Craft 3.3.19

Thanks for any help.

2

MySQL uses a list of stopwords when performing full-text searches. As you can see, about and still are in there... At the top of the page they say:

False hits or misses might occur for stopword lookups...

I think this is the issue here. One way to get around it in your case is to add the below in your config/general.php (docs):

'defaultSearchTermOptions' => [
    'subLeft' => true,
],

If the above helps, another thing you can try is to change the storage engine your searchindex table from MyISAM to InnoDB. That would allow you to remove what you've added in your config/general.php but would require you to have at least MySQL v5.6+.

| improve this answer | |
  • MildlyGeeky in the discord server suggested defaultSearchTermOptions too. I tried that and saw no change, but this time it seems to fix it, so I guess you're right. Thank you! – user2157969 Jan 5 at 17:45

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.