Never sort search results with directories above files, regardless of the setting.
The first commit is enough for both canvas view and the new icon view. But it doesn't take full effect on list view without the changes in the second commit, as explained in the commit message.