Alignment of defect dipoles in polycrystalline ferroelectrics