FulltextSearchable


#1

I’m using SilverStripe 4.1 and building a site search. My local database is MySql 5.7, but my dev/production uses 5.5.61. It seems that while 5.7 can handle Fulltext searches on InnoDB, 5.5 can’t.

If I change the tables to MyISAM manually, they revert back as soon as I do a dev/build, and putting FulltextSearchable::enable() in the _config.php file doesn’t seem to do anything.

What is the proper way to enable MyISAM tables in SilverStripe 4.1?


#2

Something like this

 private static $create_table_options = [
        'MySQLDatabase' => 'ENGINE=MyISAM'
    ];

in your model should do the trick.


#3

Thanks @Greg_808.
I had a go at that but how do I do that for the File & SiteTree tables?

It doesn’t work if I add it to the Page class, so do I just extend the File & SiteTree classes?


#4

I don’t know exactly how to do that. But I would write an extension for file and sitetree or theoretically it should also be possible to set it in an yml config.