User:RichMorin/mw searchindex

From Meta, a Wikimedia project coordination wiki

When using the default MySQL search backend, page titles and text are munged to strip markup, do Unicode case folding, and prepare the result for MySQL's fulltext index.

This table must be MyISAM; InnoDB does not support the needed fulltext index.


Inter-table Relationships[edit]

  • si_page - page ID ( page.page_id)


MySQL Table Description[edit]

mysql> desc mw_searchindex;
+----------+-----------------+------+-----+---------+-------+
| Field    | Type            | Null | Key | Default | Extra |
+----------+-----------------+------+-----+---------+-------+
| si_page  | int(8) unsigned |      | PRI | 0       |       |
| si_title | varchar(255)    |      | MUL |         |       |
| si_text  | mediumtext      |      | MUL |         |       |
+----------+-----------------+------+-----+---------+-------+
3 rows in set


Annotated Table Creation Code[edit]

-- When using the default MySQL search backend, page titles
-- and text are munged to strip markup, do Unicode case folding,
-- and prepare the result for MySQL's fulltext index.
--
-- This table must be MyISAM; InnoDB does not support the needed
-- fulltext index.

CREATE TABLE /*$wgDBprefix*/searchindex (

  -- Key to page_id

  si_page             int(8)         unsigned     NOT NULL,
  
  -- Munged version of title

  si_title            varchar(255)                NOT NULL  default '',
  
  -- Munged version of body text

  si_text             mediumtext                  NOT NULL  default '',
  
UNIQUE KEY            (si_page),
FULLTEXT              si_title (si_title),
FULLTEXT              si_text (si_text)

) ENGINE=MyISAM;