Relevanssi - A Better Search
[resolved] Filter Request (w/ solution) (5 posts)

  1. justin_k
    Posted 3 years ago #

    Hey Mikko,

    I have a small request: would you be willing to stick a filter at the beginning of relevanssi_get_comments(), like:

    if(apply_filters('relevanssi_index_comments_exclude', $postID)) return "";

    This would allow the exclusion of comments on specific posts from being indexed, without needing to exclude the post entirely:

    add_filter('relevanssi_index_comments_exclude', 'jgk_relevanssi_excludecomments');
    function jgk_relevanssi_excludecomments($postID)
        if($postID == 6493) return true;

    It'd be much appreciated. I really like the ability to index comments, but I have just ONE page with a ridiculous number of comments (thousands), the indexing of which makes search time blow up from ~1s to >30s. By just excluding those, I could continue to enjoy comment-indexing in general without the penalty of just that one page.

    Thanks in advance! :)


  2. Mikko Saari
    Plugin Author

    Posted 3 years ago #

    Sure, why not. I'll add this to the next version.

  3. justin_k
    Posted 3 years ago #

    Excellent, thanks :)

  4. Mikko Saari
    Plugin Author

    Posted 3 years ago #

    Small change, though, to your code. I think the correct form for this is

    apply_filters('relevanssi_index_comments_exclude', false, $postID);

    That is, the first argument is the boolean value to filter, and the second argument is a parameter value to guide the filter (aka. the post ID).

  5. justin_k
    Posted 3 years ago #

    Ah yes - right you are :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Relevanssi - A Better Search
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.