XF 2.2 Search source backwards compatibility break

Mike

XenForo developer
Staff member
This backwards compatibility break is relevant to developers who have classes that extend XF\Search\Source\AbstractSource or who use the search_source_setup code event. This may also be relevant if you extend XF\Search\Query\Query.

2.2 includes changes to the search query classes to allow more clear separation between specific types of queries. Previously, there was only one query class, XF\Search\Query\Query. This is now the base class that primarily applies generally-applicable filters. Keyword-based searches now extend from that with a KeywordQuery class. (XFES uses its own MoreLikeThisQuery for similar threads, for example.)

As such, XF\Search\Source\AbstractSource has had a signature change to its search method, as this now takes a KeywordQuery object. To support 2.2, you will need to change your source class's implementation to have the correct signature for this method.

As a mismatched signature is a fatal error in PHP, in order to prevent fatal errors from occuring when people upgrade, the search_source_setup event has been replaced with search_source_setup_22. The previous event will no longer be fired. Once you have updated your source class to have the correct signature, you should adjust the search source setup event you listen to and your search source implementation should be functional again.
 
Top Bottom