If your site is not indexing posts, here’s how you can debug it.
First, see if fetching content works. Find this:
foreach ($content as $post) { $n += relevanssi_index_doc($post->ID, false, $custom_fields); // n calculates the number of insert queries } |
and change it to
$wpdb->print_error(); foreach ($content as $post) { $n += relevanssi_index_doc($post->ID, false, $custom_fields); var_dump($post->ID); // n calculates the number of insert queries } |
Then build the index. If everything works, you should see a list of all post IDs Relevanssi will index. If it doesn’t work, there should be a helpful error message.
If you do get a list of post IDs, but indexing still doesn’t work, find this:
if (!empty($values)) { $values = implode(', ', $values); $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"; $wpdb->query($query); } |
and change to this:
if (!empty($values)) { $values = implode(', ', $values); $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"; var_dump($query); $wpdb->query($query); $wpdb->print_error(); } |
This prints all the INSERT queries that put stuff in the database and also shows possible errors.
If this too shows lots of INSERT queries and no errors, yet indexing doesn’t work, things are seriously odd. Contact me for further assistance.