WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Relevanssi : Index document is 0 , but its showing index complete (10 posts)

  1. nirav.shingala
    Member
    Posted 1 year ago #

    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
    	}

    To

    foreach ($content as $post) {
    var_dump($post->ID);
    		$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

    var_dump($insert_data);
    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 .

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Jonny007-MKD
    Member
    Posted 1 year ago #

    Hello,
    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.

  4. Jonny007-MKD
    Member
    Posted 1 year ago #

    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, '300x262', 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)

    greetz
    Jonny007

  5. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. radeko
    Member
    Posted 1 year ago #

    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!
    r

  7. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Try to deactivate the plugin and reactivate it again.

  8. radeko
    Member
    Posted 1 year ago #

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

  9. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

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

  10. radeko
    Member
    Posted 1 year ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic