Title: Relevanssi Table missing
Last modified: July 29, 2022

---

# Relevanssi Table missing

 *  Resolved [chabekah](https://wordpress.org/support/users/chabekah/)
 * (@chabekah)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/)
 * I have seen a couple of errors like this in the forum.
 * I too do not have the relevanssi table(s) in my MySQL schema – which is throwing
   errors during search.
 * Build index is responding something sensible about how many records are being
   indexed, although that seems odd since there is no relevanssi table for the index
   results to be written to. I have deactivated as well as uninstalled (and reinstalled/
   reactivated) the plugin a couple of times. But there is still no wp_relevanssi
   table in my schema, so query monitor throws a few (table mising) errors. The 
   error log file in PHP throws no errors – other than when it is trying to access
   the missing (xxx_relevanssi) table. My ajax calls all seem to be working (i.e.
   no 500 errors) – but when there is no base table, it’s hardly surprising that
   relevanssi won’t work. Suggestions?
 * I am running Relevannsi 4.16 on an Ubuntu install on WSL2. My database user should
   have create table permissions. I am also using Relevanssi Live Ajax Search, composer
   and PHP 7.4 on Apache 2.
    -  This topic was modified 3 years, 8 months ago by [chabekah](https://wordpress.org/support/users/chabekah/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15871211)
 * It looks like you may need to manually create the table if Relevanssi cannot 
   create it for you. Here’s the structure:
 *     ```
       doc	bigint(20) [0]	
       term	varchar(50) [0]	
       term_reverse	varchar(50) [0]	
       content	mediumint(9) [0]	
       title	mediumint(9) [0]	
       comment	mediumint(9) [0]	
       tag	mediumint(9) [0]	
       link	mediumint(9) [0]	
       author	mediumint(9) [0]	
       category	mediumint(9) [0]	
       excerpt	mediumint(9) [0]	
       taxonomy	mediumint(9) [0]	
       customfield	mediumint(9) [0]	
       mysqlcolumn	mediumint(9) [0]	
       taxonomy_detail	longtext	
       customfield_detail	longtext	
       mysqlcolumn_detail	longtext	
       type	varchar(210) [post]	
       item	bigint(20) [0]
       ```
   
 * With these indices:
 *     ```
       PRIMARY	doc, term, item
       INDEX	term(20)
       INDEX	term_reverse(10)
       INDEX	type(190), item
       INDEX	type(32)
       ```
   
 *  Thread Starter [chabekah](https://wordpress.org/support/users/chabekah/)
 * (@chabekah)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15873107)
 * thanks for that. BTW, I’m also getting error messages for a missing xxx_relevanssi_log
   table. what’s the def for that? I guess I could also just look at the source 
   code for the plugin and see what the activate hook does as there may be other
   tables too.
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15873221)
 * The tables are created in `relevanssi_create_database_tables()` in `lib/init.
   php`. The log table has
 *     ```
       id bigint(9) NOT NULL AUTO_INCREMENT,
       query varchar(200) NOT NULL,
       hits mediumint(9) NOT NULL DEFAULT '0',
       time timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
       user_id bigint(20) NOT NULL DEFAULT '0',
       ip varchar(40) NOT NULL DEFAULT '',
       PRIMARY KEY id (id)
       ```
   
 * and an index on `query`.
 *  Thread Starter [chabekah](https://wordpress.org/support/users/chabekah/)
 * (@chabekah)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15887634)
 * In the end I deleted the `relevanssi_db_version` option from the `wp_options`
   table since that seems to be the variable that `relevanssi_create_database_tables`
   checks before building the tables. It then built the tables for me. I think the
   problem for me was caused by importing the database from another WP install that
   didn’t have the relevanssi tables in the export – but did have all the options
   in it. So, the `relevanssi_db_version` version was set in my options table without
   the tables being there. And I am also adding/removing plugins using composer (
   rather than the normal WP UI). I’m not 100%, but it’s possible that removing 
   relevanssi that way does not run `lib/uininstall.php` which would ordinarily 
   remove all the relevanssi options from the database. Either way, all seems to
   be solved here. Many thanks!
    -  This reply was modified 3 years, 8 months ago by [chabekah](https://wordpress.org/support/users/chabekah/).
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15887973)
 * Yeah, it’s possible the Composer uninstall just removes the files. I’m not sure
   if something can be done about that.
 * I could add a tool to clean out Relevanssi options before uninstall, and also
   a method to try to readd the tables if they’re missing.
 *  Thread Starter [chabekah](https://wordpress.org/support/users/chabekah/)
 * (@chabekah)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15889674)
 * This page [https://rxnlabs.github.io/wp-composer/faqs.html](https://rxnlabs.github.io/wp-composer/faqs.html)
   would suggest that `composer uninstall x` doesn’t trigger the normal WP uninstall
   process – but the author’s WP composer plugin does do that. I’m guessing this
   must be a common problem for all WP sites using composer, but in 10 minutes of
   googling I couldn’t find anything definitive about that. I wonder how other plugin
   vendors solve this problem – but for you, yes, I’d say that a manual check of
   whether the db tables exist or not might be better than checking the options 
   table, although depending on what else your init process does, things might get
   confused. But you know your plugin an awful lot better than I! Thanks so much
   for the support.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Relevanssi Table missing’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=2025044)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [chabekah](https://wordpress.org/support/users/chabekah/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/relevanssi-table-missing/#post-15889674)
 * Status: resolved