1. A method comprising: executing instructions stored on a machine-readable medium readable by a processor which when executed cause the processor to perform operations comprising: receiving a search query including a token, the search query to be performed on data in a database stored on the machine-readable medium or a different machine-readable medium, the database including items of data that are represented by data strings; determining a synonym candidate for the token; adding the synonym candidate as a synonym for the token into an expansion dictionary in response to a determination that the number of data strings having the synonym candidate exceeds a threshold and a determination that the synonym candidate and the token are in a same category for a level of a tree hierarchy in the database, the tree hierarchy including a plurality of nodes having parent-child relationships; expanding the search query to include the synonym to form an expanded search query; and performing a search, using the expanded search query, for data in the database.