wrote user queries API for search history and logging