move streaming search into its own function