1. A computing system for rewriting queries, comprising: a computer executed module, when executed by a processor of the computing system, configured to receive, from a device configured to communicate with a search engine, a source query and features associated with the source query, the features including a device type of the device; a computer executed module, when executed by the processor, configured to: generate a data tree from historical search queries and results stored in a search log, wherein the data tree is generated in a data tree structure comprised of a root node including the source query and at least three node levels extending from the root node, wherein the at least three node levels include: a first result level comprised of first result nodes including results corresponding to the source query, a first query level comprised of first query nodes including queries corresponding to the results included in the first result nodes, a second result level comprised of second result nodes including results corresponding to the queries included in the first query nodes, and linking edges configured to link a result node with a query node from different node levels, wherein the data tree is generated in the data tree structure for accessing a representative subset of information from the historical search queries and results and including relationship information via the linking edges; store the data tree in a database; access, from the database, the data tree; and extract, from the data tree, a data subset based on the root node representing the source query, wherein the data subset includes a predetermined number of node levels extending from the root node, wherein each node level includes a subset query node, a subset result node, and a subset linking node linking the subset query node with the subset result node; a computer executed module, when executed by the processor, configured to assign a cost to at least one linking edge included in the data subset, the cost being based on the features associated with the source query; a computer executed module, when executed by the processor, configured to determine a cumulative cost for each subset query node in the data subset; and a computer executed module, when executed by the processor, configured to recommend a selected query node from among the subset query nodes included in the data subset based on the cumulative cost of the plurality of subset query nodes.