Reputation: 405
I have thousands of tags, which I don't want to be indexed. How can I set Algolia plugin not to index taxonomy_post_tag
and post_author.display_name
?
Upvotes: 1
Views: 287
Reputation: 798
To begin with, I'm not sure the optimizations you are willing to do are worth the trouble.
Indeed, regarding usage quotas, Algolia doesn't care about your record size as long as you are under the limit put to 10kb per record. It could be a search optimization consideration though if you have lots of records, like 500k or more.
In your case you could probably keep the 2 attributes as they are in the records.
If you really want to clean it up, you will have to remove the attributes from the records send to Algolia, which is fairly easy to achieve with a filter hook.
function my_post_shared_attributes( array $shared_attributes, WP_Post $post) {
if ( isset( $shared_attributes['taxonomy_category'] ) ) {
unset( $shared_attributes['taxonomy_category'] );
}
if ( isset( $shared_attributes['post_author'] ) ) {
unset( $shared_attributes['post_author'] );
}
return $shared_attributes;
}
add_filter( 'algolia_post_shared_attributes', 'my_post_shared_attributes', 10, 2 );
We split every post into multiple Algolia records based on the DOM structure of the post's content. This ensures no record will break the record size limit of 10kb, and even better, that it stays under 3kb most of the time which is optimal for the Algolia engine.
Upvotes: 1