apply_filters( 'relevanssi_indexing_values', array $values, object $post )

Filters the INSERT query VALUES sections before the queries are run.


(array) An array of rows to insert into the database.

(object) The post object (usually a WP_Post object) that is being indexed.

More information

When Relevanssi indexes a post, the post content is manipulated in many ways and finally tokenized. These tokens and their occurrance counts are converted into an array of data that is passed through relevanssi_indexing_data and then Relevanssi generates the rows that are inserted into the database. These rows go through this filter hook.

This is how the rows are generated:

$value = $wpdb->prepare(
  '(%d, %s, REVERSE(%s), %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %s, %s, %s, %d)',

These rows are collected into an array and then inserted into the database with this:

  INTO wp_relevanssi (doc, term, term_reverse, content, title, comment, tag, link, author, category, excerpt, taxonomy, customfield, type, taxonomy_detail, customfield_detail, mysqlcolumn)
  VALUES $values

This is thus the final step where you can filter the post content before it is indexed. In practise, using this filter hook is hardly necessary. Usually it’s better to do any modifications earlier. If you want to manipulate this data, use relevanssi_indexing_data, but more often you’ll want to use relevanssi_post_content to manipulate the post content rather than these tokens.