apply_filters( 'relevanssi_indexing_data', array $insert_data, object $post )

Filters the indexed data before it’s converted into INSERT queries.


(array) An array of tokens and their counts.

(object) The post object.

More information

This filter hook runs fairly late in the indexing process. At this stage, Relevanssi has already figured out all the words (tokens) that are in the post, and the next step is to create the INSERT queries that will store them in the database.

What this filter hook filters is an array where the key of the array is the word in the post, and the value is an array of counts: how many times that word appears in different parts of the post. The array has the following values:

  • content
  • title
  • comment
  • tag
  • link (for Relevanssi internal link indexing)
  • author
  • category
  • excerpt
  • taxonomy (all taxonomies except categories and tags)
  • customfield
  • mysqlcolumn (custom MySQL columns)
  • taxonomy_detail (a JSON object detailing which taxonomies the taxonomy value covers)
  • customfield_detail (a JSON object detailing which custom fields the word appears in)

After this filter hook, the values are put in place with $wpdb->prepare() and the results of that process are then passed through relevanssi_indexing_values.

I don’t really know if there’s much use for this filter hook for modifying the values, but at least this can be used for debugging the indexing process.