This document proposes techniques for automatically ranking the results of database queries. It introduces IDF Similarity, which adapts the TF-IDF concept from information retrieval to database attributes by calculating IDF scores based on attribute value frequencies. It also introduces QF Similarity, which determines attribute value importance based on frequency in a query workload log. An Index-based Threshold Algorithm is developed to efficiently retrieve the top-K results by exploiting these similarity functions. The algorithm performs sorted and random accesses to tuples to iteratively refine the top results based on a stopping condition.