Search code examples
symfonydoctrineinnodbfull-text-search

Symfony2 and Match Against, table InnoDB


I had a problem to implement Match Against with symfony2, but I almost solve the problem thanks to stackoverflow : MATCH AGAINST script is not working with Symfony2

I did what Picoss said, but now I have another problem :

SQLSTATE[HY000]: General error: 1214 The used table type doesn't support FULLTEXT indexes

After some search on google I suppose the reason is because of InnoDB table type, but I don't know how to change it in Symfony2 (and I have to search something on a table generated by an entity of fosuserbundle. Second solution can be to upgrade my mysql version (I am actually on the 5.1.66-0 version, but I am not sure if it will solve the problem or not).

Do you have any other ideas ?

Thanks


Solution

  • You can add the engine option in the @ORM/Table definition:

    For annotions:

    <?php
    
    namespace My\Bundle\Entity;
    
    use Doctrine\ORM\Mapping as ORM;
    
    /**
     * MyEntity
     *
     * @ORM\Table(name="my_entity", options={"engine"="MyISAM"})
     * @ORM\Entity(repositoryClass="My\Bundle\Entity\Repository\MyEntityRepository")
     */
    class MyEntity
    {
        //...
    }
    

    Hope this helps