Fixed database error by invalid condition with parentheses in TicketSearch, thanks to Norihiro Tanaka!
This fixes bug#9486.