use build_filter_conditions from db_query. Fixes #1679