I need to use full text search but the tables that I am using in my web application use the INNODB engine, from what I read JDBC does not have support for Mysql triggers and I am supposed to deploy the project on the course server so installing tools such as sphinxs is not possible, could someone please suggest a method to perform a full-text search?
Edit: the requirement in the project is to have a consistent database, the table on which I want to perform search contains the list of instruments that exist in the lab for which I am building the web application, it is possible to insert new instruments to it, but let's assume that the insert accesses are few and that mostly the table will be used for read access, in this case, is using MyIsam justifiable and would it conform with the consistency requirements (Myisam doesn't support transactions)?
You can create a second table using MyISAM that contains only the primary key of the main table and the text content you wish to
FULLTEXT search over. Then when you want to do a fulltext search, you do a
JOIN between the proper InnoDB table, and the search-bait MyISAM table, with a
MATCH condition against the MyISAM table.
This also allows you to store different search-bait text in the MyISAM table to the ‘real’ text in the InnoDB table, which allows you implement features like stemming or special apostrophe/hyphen handling that MySQL's
FULLTEXT engine can't manage.
The problem here of course is keeping the MyISAM data consistent with the InnoDB data. You can either run a job every so often to do it, or make the app write to both tables any time there is a text update. Either way, hopefully you can get away with inconsistency in fulltext searching, where it would be unacceptable for the ‘canonical’ table data.
Another approach is just to fall back to
RLIKE (regexp) matching when the fulltext solution you want isn't available. Will be unindexable so not fast, but at least it'll always work, and it's fine for smaller databases.
the table on which I want to perform search contains the list of instruments that exist in the lab for which I am building the web application
OK, does that really have to be
FULLTEXT searchable? Wouldn't it be better to model such a list as one entity per type of equipment, and a join table between labs and equipments (or whatever it is)?
so if 2 inserts happen at the same time?
MyISAM won't let two
INSERTs claim the same primary key. But this isn't enough to guarantee ‘consistency’ in the general case. Whilst it sounds like you could get away with it from a practical point of view, if there is a explicit requirement for ‘consistency’ that's probably exactly what they don't want you to do.