Support » Plugin: Relevanssi - A Better Search » Relevanssi : Index document is 0 , but its showing index complete

  • nirav.shingala


    Hello ,

    Relevanssi plugin is not able to index the documents , and its showing index complete . I checked database , changed database table from InnoDB to MyISAM , activated and de-activated a plugin .

    Also checked out the trouble shooting guide ,

    1) Changed

    foreach ($content as $post) {
    		$n += relevanssi_index_doc($post, false, $custom_fields);
    		// n calculates the number of insert queries


    foreach ($content as $post) {
    		$n += relevanssi_index_doc($post, false, $custom_fields);
    		// n calculates the number of insert queries

    It showes my all IDs

    2) Var DUMP

    I put

    before the $index_titles = true;

    and it showed me

    array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } ……

    Can anyone please help me with this , I am using relevanssi 3.0.4 .

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mikko Saari


    Re 2), at that point it is possible the $insert_data is empty.

    Find this in /lib/indexing.php:

    $query = "INSERT IGNORE INTO $relevanssi_table (doc, term, content, title, comment, tag, link, author, category, excerpt, taxonomy, customfield, type, taxonomy_detail, customfield_detail, mysqlcolumn)
    			VALUES $values";

    and after that line, add var_dump($query); and tell me what that says.

    I’ve got the same problem.
    $insert_data is not empty and neither is $query at the line you’ve mentioned. (its a lot of data thats coming out)
    However there remain 0 entries in the index.

    I did more research. This is one $query put into PMA:

    INSERT IGNORE INTO wp_relevanssi( doc, term, content, title,
    COMMENT , tag, link, author, category, excerpt, taxonomy, customfield,
    TYPE , taxonomy_detail, customfield_detail, mysqlcolumn )
    VALUES ( 13, ‘image1’, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, ‘attachment’, ”, ”, 0 ) , ( 13, ‘300×262’, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, ‘attachment’, ”, ”, 0 )

    MySQL said: Documentation
    #1054 – Unknown column ‘content’ in ‘field list’

    which is correct because wp_relevanssi only contains the fields:

    • id => mediumint(9)
    • doc => bigint(20)
    • term => varchar(50)
    • tf => mediumint(9)
    • title => tinyint(1)

    Maybe you did not alter the table after an update, because your init.php contains the “CREATE TABLE $relevanssi_table” with all this fields.

    Two things to do: Telling the user that an error occured while indexing (also printing the wp_query->error or something), altering the table when the tables are in an old version.

    Also two ways for users as solution:

    1. I would say that reinstalling the plugin would solve the problem, but I don’t want to loose my config.
    2. Another way is to execute the MySQL-Commands as is, for example in PMA or with a PHP-Script which works with wp_query():

      RENAME TABLE PREFIX_wp_relevanssi TO PREFIX_wp_relevanssi_backup

      if you think you could need a backup.

      CREATE TABLE PREFIX_wp_relevanssi (doc bigint(20) NOT NULL DEFAULT ‘0’,
      term varchar(50) NOT NULL DEFAULT ‘0’,
      content mediumint(9) NOT NULL DEFAULT ‘0’,
      title mediumint(9) NOT NULL DEFAULT ‘0’,
      comment mediumint(9) NOT NULL DEFAULT ‘0’,
      tag mediumint(9) NOT NULL DEFAULT ‘0’,
      link mediumint(9) NOT NULL DEFAULT ‘0’,
      author mediumint(9) NOT NULL DEFAULT ‘0’,
      category mediumint(9) NOT NULL DEFAULT ‘0’,
      excerpt mediumint(9) NOT NULL DEFAULT ‘0’,
      taxonomy mediumint(9) NOT NULL DEFAULT ‘0’,
      customfield mediumint(9) NOT NULL DEFAULT ‘0’,
      mysqlcolumn mediumint(9) NOT NULL DEFAULT ‘0’,
      taxonomy_detail longtext NOT NULL,
      customfield_detail longtext NOT NULL,
      mysqlcolumn_detail longtext NOT NULL,
      type varchar(210) NOT NULL DEFAULT ‘post’,
      item bigint(20) NOT NULL DEFAULT ‘0’,
      UNIQUE KEY doctermitem (doc, term, item)) COLLATE utf8_general_ci

      Change strong text as applicable (PREFIX most of the times does not exist, collation can be looked up at the old table)


    Plugin Author Mikko Saari


    Relevanssi does upgrade the tables, but the upgrade doesn’t trigger when you update the plugin from the WordPress plugin dashboard. If you deactivate the plugin (no need to delete it) and reactivate it, then the database upgrade happens.

    There’s no ALTER TABLE clause, because WordPress does that automatically by comparing the current table to the CREATE TABLE clause.

    Hi I have similar problem, var_dump($post->ID) show all my IDs.
    var_dump($insert_data) – has nulls
    BUT var_dump($query) does not show anything. Where should I look for an error?
    I am using relevanssi 3.0.5

    thank you!

    Plugin Author Mikko Saari


    Try to deactivate the plugin and reactivate it again.

    Thank you Mikko, deactivation does not work, reinstalling the plugin also, I even deleted plugin tables but this does not work too.

    Plugin Author Mikko Saari


    In that case it’s hard to say what’s wrong. Could be many, many things.

    Thank you Mikko for your free support via email. The problem was with PHP PCRE on Amazon EBS instance. After updating the instance everything works!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Relevanssi : Index document is 0 , but its showing index complete’ is closed to new replies.