title: Sphinx / Solr for keyword / frequency queries
body: <p>We need to be able to perform two types of queries efficiently against a table containing several million records:</p>
  
  <p>1) Return the "x" most recent records which contain keyword "y".</p>
  
  <p>2) Return the "x" most frequent keywords for a group of records.</p>
  
  <p>We have been thinking about using some external search server such as Sphinx or Solr, but we are not sure if any of those will be able to support both types of queries.</p>
  
  <p>So, which is the most efficient way to be able to perform those types of queries?</p>