Fixed limitation of search items

Fixes bug #10513
Please comment on what @blizzz said. These lines are also against our coding convention, please always use curly braces. Thanks!