correct handling of OR in WHERE clause of search sql