MySQL Full-Text Search

From Littledamien Wiki
Revision as of 13:44, 5 March 2024 by Video8 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Configure full-text search[edit]

  • Create a fulltext index on the table to be searched.
  • Table must us MyISAM engine to support fulltext indexes.
  • Using MySQL Workbench
    • Alter Table > Table tab > Engine: MyISAM
    • Alter Table > Indexes tab > Index Name: FT_whatever > Type: FULLTEXT > select columns

Performing full-text search[edit]

SELECT cn1, cn2,... FROM table WHERE (MATCH(c1,c2,...) AGAINST ('searchterm' IN BOOLEAN MODE))

MySQL Database types[edit]

MyISAM[edit]

  • Full-text search

InnoDB[edit]

  • Default table type when creating a new table in MySQL
  • More resource intensive
  • Supports foreign keys
  • Faster performance (doesn't lock tables for reads & writes)
  • Supports transactions
  • Does not support full-text search