Creating database from search queries