Refactor publisher search into generate-id