As designed inTitleOnly/inTitleOnly moved from Query to KeywordQuery

Xon

Well-known member
Affected version
XF2.1.0 Beta 1
The functions getTitleOnly/inTitleOnly have been removed from XF\Search\Query\Query and exist on XF\Search\Query\KeywordQuery` but applyTypeConstraintsFromInput only takes a Query argument.

Both MoreLikeThisQuery and KeywordQuery both have these methods, so I'm unsure why it was removed as ultimately title/body are critical search fields. And a search query which wants to ignore the difference could do that quite easily.

This makes supporting XF2.0/XF2.1 and XF2.2 more complicated than it needs to be.
 
Although both query objects have these methods, the concept is somewhat specific to these query types (and a bit distinct with respect to what each type ultimately does with it). Equally, it's not out of the question that a future or 3rd party query type won't have the concept of a "title only" search at all. While it could be ignored in such a case, I could see that becoming a potential source of confusion. The BC break generally applies to the withKeywords() method all the same, so I think wrapping calls in a conditional if you must support multiple versions (cumbersome though it may be) is the way to go here.
 
Top Bottom