fixes #2602 - scoped_search error when using postgresql