Fixed #435. Support searching through intermediate relations