Implementation details. InstallTerm() needs to check whether the term is present in the splay tree or needs to be added. It should also efficiently check if the docno is the same as the last time and simply increment the appropriate counter in this case.

Splay trees are appropriate technology because we can count on the many frequency-based queries to cause the resulting tree to become well-balanced with use.