CRM-12639-fixes : fixes for search builder, and where clause handling