1. A method for determining which sub-strings, of a plurality of sub-strings of a string, are logically related to the string, the method comprising the computer-implemented steps of: monitoring which queries are submitted during a plurality of sessions; forming an affinity set for a particular query that represents said string, wherein the affinity set for said particular query includes one or more other queries that were submitted in a same session as said particular query; identifying, within the affinity set, which of the one or more other queries represent one or more sub-strings of the string; for each sub-string of the plurality of sub-strings, determining a first number of sessions, of said plurality of sessions, that include at least one query that represents the string and at least one query that represents the sub-string but not the string; determining a second number of sessions, of said plurality of sessions, that include at least one query that represents the sub-string and no queries that represent the string; determining which sub-strings, of said plurality of sub-strings, are logically related to said string based, at least in part, on both the first number of sessions and the second number of sessions; wherein the method is performed by one or more processors.