title: Lucene Field Grouping
body: <p>say i m having fields stud_roll_number and date_leave.</p>
  
  <p><strong>select stud_roll_number,count(*) from some_table where date_leave > some_date group by stud_roll_number;</strong></p>
  
  <p>how to write the same query using Lucene....I tried after querying date_leave > some_date</p>
  
  <p>for (ScoreDoc scoreDoc : topDocs.scoreDocs) {</p>
  
  <pre><code>    Document doc = search.doc(scoreDoc.doc);
  
  String value = doc.get(fieldName);
  
  Integer key = mapGrouper.get(value);
  
  if (key == null) {
      key = 1;
  } else {
      key = key+1;
  }
  
  mapGrouper.put(value, key);
  </code></pre>
  
  <p>}</p>
  
  <p>But, I m having huge data set, it takes much time to compute this. Is there any other way to find it???? Thanks in advance...</p>