Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Searching within RSS feeds was disabled on purpose a few versions ago because it would break the RSS feed functionality –?the feeds would no longer display the latest posts.

    You can enable feed searching with:

    add_filter( 'relevanssi_search_ok', function( $ok, $query ) {
      if ( $query->is_feed ) {
        return true;
      }
      return $ok;
    }, 10, 2 );
    Thread Starter Rafael Fischmann

    (@rfischmann)

    Thank you, @msaari! But, if I do add that code, will it break the RSS feed functionality?

    Plugin Author Mikko Saari

    (@msaari)

    I suppose it depends on your use case. It won’t do anything to RSS feeds when you don’t search, but if you rely on RSS feeds with searches to always show the latest posts first, that’s broken. But if you don’t mind that, then you’re fine.

    Thread Starter Rafael Fischmann

    (@rfischmann)

    Got it.

    Well, @msaari, I deployed the code and it does bring the search functionality back — which is awesome. However, I have no idea why, it’s making our server’s CPU skyrocket. I had to restart MySQL to bring it back to life. Any idea why?

    As soon as I commented the code out again from functions.php, everything came back to normal.

    Plugin Author Mikko Saari

    (@msaari)

    Do you have lots of traffic on your feed searches? If you have, then that’s the reason: processing the feed searches with Relevanssi takes more resources.

    Thread Starter Rafael Fischmann

    (@rfischmann)

    I wouldn’t know for sure, but according to that behavior, I probably do have lots of traffic. Our mobile iOS app uses it, for example.

    Can’t I disable Relevanssi just for feed searches, maybe?

    Plugin Author Mikko Saari

    (@msaari)

    We come to where we started: Relevanssi is disabled for feed searches, unless you enable it with the snippet above.

    But throw in this:

    add_filter( 'relevanssi_prevent_default_request', function( $prevent, $query ) {
        if ( $query->is_feed ) {
            return false;
        }
        return $prevent;
    }, 10, 2 );

    I’ll add this to the next version of Relevanssi.

    Thread Starter Rafael Fischmann

    (@rfischmann)

    I think now it’s all good, @msaari! ?? Feed searches are working and no effect on the server at all!

    Thank you very much!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Not working for searching on feeds’ is closed to new replies.