It has always been the implicit assumption, because that’s what Relevanssi gets from WordPress. There’s a knowledge base article from 2011 that says “The function takes a WP_Query object as a parameter”…

However, pre 1.15.0 Relevanssi didn’t use any of the member methods in WP_Query, just the variables. 1.15.0 was the first version to set the operator with $query->set(), causing the error. So until 1.15.0, you’ve been able to use a stdClass object, as long as you’ve set the necessary attributes.

So far that’s the only place where Relevanssi is currently using WP_Query methods, but it’s assuming that several attributes are in place. I suppose I could have Relevanssi just directly set the variable instead of using the set() function, but then the problem is just passed later – the fact remains that Relevanssi expects a WP_Query, and passing one is the only way to be sure everything’s fine.

If you call $query = new WP_Query(); without any arguments, no query is run. You can then populate the necessary attributes, and pass the object to Relevanssi.

That said, I can change that ->set() to just directly set the variable, but I can’t promise future compatibility – there may be times when it’s really necessary for Relevanssi to do something WP_Query specific with the query, and then I’m not going to worry too much about this, so for future compatibility it is better to use WP_Query object there.

Sure, I’ll make the change in the next version. Before that is out, you can point people in need of a hotfix to this version of search.php, which already contains the fix and can be used to replace the current lib/search.php.

Thanks to Mikko and Matt Gibbs. I updated to the latest free Relevanssi version and had this exact problem. Couldn’t see any reference to it in the change log, and so rolled back to the previous version.