title: SOLR : How to make solr filter on collapsed result set
body: <p>I have a problem using SOLR Collapse which gives me unexpected result.</p>
  
  <p>Assuming  travellers:</p>
  
  <pre><code>{ traveller_id: 1, geo_hash: 4_u3bu, start_time: 2016-07-14T23:59:00Z },
  { traveller_id: 1, geo_hash: 4_de5f, start_time: 2018-07-14T23:59:00Z },
  { traveller_id: 2, geo_hash: 4_u3bu, start_time: 2018-07-14T23:59:00Z },
  </code></pre>
  
  <p>Basically I got 2 fq in my query like the followings...</p>
  
  <p>The first one groups document by traveller id having most recent start time. </p>
  
  <pre><code>fq={!collapse field=traveller_id min=ms(now,start_time) }
  </code></pre>
  
  <p>At this point, when I only add that filter in my query, I get the following result:</p>
  
  <pre><code> { traveller_id: 1, geo_hash: 4_de5f, start_time: 2018-07-14T23:59:00Z},
   { traveller_id: 2, geo_hash: 4_u3bu, start_time: 2018-07-14T23:59:00Z},
  </code></pre>
  
  <p>Looks good... But, wait!</p>
  
  <p>If I also add an extra fq to only get the documents with a particular geohash, within the latter below:</p>
  
  <pre><code>fq=geohash: (4_u3bu)
  </code></pre>
  
  <p>Then the results becomes incorrect:</p>
  
  <pre><code>{ traveller_id: 1, geo_hash: 4_u3bu, start_time: 2016-07-14T23:59:00Z },
  { traveller_id: 2, geo_hash: 4_u3bu, start_time: 2018-07-14T23:59:00Z },
  </code></pre>
  
  <p>Looks like solr started by picking up the traveller with geohash: 4_u3bu and only then does the grouping.</p>
  
  <p>Why is that ? I expected Solr to first group by most recent traveller and then applying the geohash filter...</p>
  
  <p>Result expected is:</p>
  
  <pre><code>{ traveller_id: 2, geo_hash: 4_u3bu, start_time: 2018-07-14T23:59:00Z },
  </code></pre>
  
  <p>Is there anyway to solve that ??</p>
  
  <p>Thanks</p>