optimized search in bcd_phot