title: Faster way to get distinct values from Lucene Query
body: <p>Currently I do like this:</p>
  
  <pre><code>IndexSearcher searcher = new IndexSearcher(lucenePath);
  Hits hits = searcher.Search(query);
  Document doc;
  List&lt;string&gt; companyNames = new List&lt;string&gt;();
  
  for (int i = 0; i &lt; hits.Length(); i++)
  {
      doc = hits.Doc(i);
      companyNames.Add(doc.Get("companyName"));
  }
  searcher.Close();
  
  companyNames = companyNames.Distinct&lt;string&gt;().Skip(offSet ?? 0).ToList();
  return companyNames.Take(count??companyNames.Count()).ToList();
  </code></pre>
  
  <p>As you can see, I first collect ALL the fields (several thousands) and then distinct them, possibly skip some and take some out.</p>
  
  <p>I feel like there should be a better way to do this.</p>