Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:15:10+00:00 2026-06-03T02:15:10+00:00

I am building an app in Symfony2, using Doctrine2 with mysql. I would like

  • 0

I am building an app in Symfony2, using Doctrine2 with mysql. I would like to use a fulltext search. I can’t find much on how to implement this – right now I’m stuck on how to set the table engine to myisam.

It seems that it’s not possible to set the table type using annotations. Also, if I did it manually by running an “ALTER TABLE” query, I’m not sure if Doctrine2 will continue to work properly – does it depend on the InnoDB foreign keys?

Is there a better place to ask these questions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:15:12+00:00Added an answer on June 3, 2026 at 2:15 am

    INTRODUCTION

    Doctrine2 uses InnoDB which supports Foreign Keys used in Doctrine associations. But as MyISAM does not support this yet, you can not use MyISAM to manage Doctrine Entities.

    On the other side, MySQL v5.6, currently in development, will bring the support of InnoDB FTS and so will enable the Full-Text search in InnoDB tables.

    SOLUTIONS

    So there are two solutions :

    1. Using the MySQL v5.6 at your own risks and hacking a bit Doctrine to implement a MATCH AGAINST method : link in french… (I could translate if needed but there still are bugs and I would not recommend this solution)

    2. As described by quickshifti, creating a MyISAM table with fulltext index just to perform the search on. As Doctrine2 allows native SQL requests and as you can map this request to an entity (details here).

    EXAMPLE FOR THE 2nd SOLUTION

    Consider the following tables :

    table 'user' : InnoDB [id, name, email]
    table 'search_user : MyISAM [user_id, name -> FULLTEXT]
    

    Then you just have to write a search request with a JOIN and mapping (in a repository) :

    <?php
    
    public function searchUser($string) {
    
        // 1. Mapping
        $rsm = new ResultSetMapping();
        $rsm->addEntityResult('Acme\DefaultBundle\Entity\User', 'u');
        $rsm->addFieldResult('u', 'id', 'id');
        $rsm->addFieldResult('u', 'name', 'name');
        $rsm->addFieldResult('u', 'email', 'email');
    
        // 2. Native SQL
        $sql = 'SELECT u.id, u.name FROM search_user AS s JOIN user AS u ON s.user_id = u.id  WHERE MATCH(s.name) AGAINST($string IN BOOLEAN MODE)> 0;
    
        // 3. Run the query
        $query = $this->_em->createNativeQuery($sql, $rsm);
    
        // 4. Get the results as Entities !
        $results = $query->getResult();
    
        return $results;
    }
    ?>
    

    But the FULLTEXT index needs to stay up-to-date. Instead of using a cron task, you can add triggers (INSERT, UPDATE and DELETE) like this :

    CREATE TRIGGER trigger_insert_search_user
    AFTER INSERT ON user
    FOR EACH ROW
    INSERT INTO search_user SET user_id=NEW.id, name=NEW.name;
    
    CREATE TRIGGER trigger_update_search_user
    AFTER UPDATE ON user
    FOR EACH ROW
    UPDATE search_user SET name=name WHERE user_id=OLD.id;
    
    CREATE TRIGGER trigger_delete_search_user
    AFTER DELETE ON user
    FOR EACH ROW
    DELETE FROM search_user WHERE user_id=OLD.id;
    

    So that your search_user table will always get the last changes.

    Of course, this is just an example, I wanted to keep it simple, and I know this query could be done with a LIKE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm building a mobile app talking to my symfony2 app via webservices I can't
I'm building app using GAE and wanted to use Django for that. Which patch
I'm building an app that authors would (hopefully) use to help them, uh.. author
I am building an app with SBT (0.11.0) using a Scala build definition like
So I'm building an App using the Entity Framework on top of SQL Compact
Building an app using android.support.v4.app , targeting API level 8. Everything's working as planned
The App Layout I am building an App, where one can create surveys. Every
I am building an app with QT using SSL. When I compile the app
I'm building an app in Symfony2 that receives a HTML string via an API,
Im building an app that will use a Core Data model. I pretty new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.