Hi,
Is there a way to make a SOLR query which will filter the result returned by 
the group.

I am having the following three document in SOLR, and I want to pick up the 
latest document based on RqDate which is associated with OrganizationIdRef:154.

So I wrote my query to group the results by UserId and sort it by RqDate 
(group=true&group.field=UserId&group.sort=RqDate desc) upto which it is 
returning the [Document 3] which is fine.

Then in order to check whether the last document I got is associated with 
OrganizationIdRef:154 or not I add a filter query (fq=OrganizationIdRef:154). 
Then instead of returning me 0 results found which I am expecting it is 
returning me the [Document 2]

Is there a way I can make a filter on the grouped result in SOLR? Please help.

Document 1:
  <doc>
    <arr name="OrganizationIdRef"><str>153</str><str>154</str></arr>
    <date name="RqDate">2012-07-07T12:50:02.323Z</date>
    <str name="UserId">1</str>
  </doc>
Document 2:
  <doc>
    <arr name="OrganizationIdRef"><str>153</str><str>154</str></arr>
    <date name="RqDate">2012-08-07T12:31:46.885Z</date>
    <str name="UserId">1</str>
  </doc>

Document 3: [latest based on RqDate]
  <doc>
    <arr name="OrganizationIdRef"><str>153</str></arr>
    <date name="RqDate">2012-09-07T12:23:31.583Z</date>
    <str name="UserId">1</str>
  </doc>

Thanks & Regards,
Subrata Sarkar
subrata.sar...@oup.com<mailto:subrata.sar...@oup.com>
+44 (0)1865 354 486 (Office)
+44 (0)7741 559 346 (Cell)


Oxford University Press (UK) Disclaimer

This message is confidential. You should not copy it or disclose its contents 
to anyone. You may use and apply the information for the intended purpose only. 
OUP does not accept legal responsibility for the contents of this message. Any 
views or opinions presented are those of the author only and not of OUP. If 
this email has come to you in error, please delete it, along with any 
attachments. Please note that OUP may intercept incoming and outgoing email 
communications.

Reply via email to