Page MenuHomePhabricator

Make Postgres search use a searchindex table
Open, MediumPublic


Postgres currently uses columns in specific tables (pagecontent.textvector and page.titlevector, both of type tsvector) to store search index information. Postgres also currently uses triggers/procedures to maintain these tables. It needs to be converted to use a searchindex table like MySQL.

This relates to MCR Schema Migration, because it prepares for when we want SearchMySQL and so on to handle more than just the main slot. By using a searchindex table, the changes to SearchPostgres will be similar rather than entirely different.


  • add a searchindex table, similar to the MySQL one, but adapted to Postgres data types. Basically page.titlevector becomes searchindex.si_title and pagecontent.textvector becomes searchindex.si_text. searchindex.si_page works exactly like it does in MySQL.
  • add related code to maintain this table. Per T164898, we don't want to keep using triggers for this. SearchPostgres::update() should do it, similar to what SearchMySQL::update() does. Same for ::updateTitle().
  • add necessary documentation and install/update support for these db changes
  • modify searchPostgres.php to use the new db changes

See T198341 for the discussion that led to this task.

Event Timeline

BPirkle created this task.Apr 8 2019, 9:04 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 8 2019, 9:04 PM
Restricted Application added a project: Discovery-Search. · View Herald TranscriptJun 27 2019, 9:07 PM
CBogen triaged this task as Medium priority.Aug 27 2020, 8:58 PM
Aklapper removed a subscriber: Anomie.Fri, Oct 16, 5:02 PM