2

I have a set of document, that contains sender mail ids and recipient mail ids.

When I use facet query like facet.field=senderemailid&facet.limit=10&facet.offset=0. So that I can get total no of mail sent by that corresponding mail id

Result was

< int name="xxx@e.com" > 157 < int >

< int name="x11@e.com" > 141 < int >

< int name="x22@e.com" > 32 < int >


As well when I use facet.field=recipientmailid&facet.limit=10&facet.offset=0, I can get total no of mail received by that corresponding mail Id.

Result was

< int name="x1x@e.com" > 41 < int >

< int name="x22@e.com" > 132 < int >

< int name="x2y@e.com" > 92 < int >

Once I get the result I use java code to group result that each email id received how many no of email and sent how many no of emails.In this way I can't achieve the pagination.Because both result differ on some email id.

What is my expectation is,

< int name="x22@e.com" >

           < int >  32  < int >

           < int >  132 < int >

< int name="x22@e.com" >

So at one shot I can get sent email & received email count at one shot.I don't need to use java code to group the result.

Is any ways exist in solr to group result in solr itself, so that I can avoid java code to group result as well I can achieve pagination

[Note : recipientmailid and senderemailid both are multivalued.If necessary later I can change senderemailid to singlevalued.But recipient mail Id should be in multivalued.]

gangatharan
  • 781
  • 1
  • 12
  • 28

1 Answers1

0

you can use facet.field multiple times and you will get facet results for both but it will be two separate objects. this way you can reduce the query to solr. the o/p will be like below

   "facet_counts":{
    "facet_queries":{},
    "facet_fields":{
      "sender":[
        "xyz@ghh.com",21,
        "xyz2@ghh.com",11,
        "xyz3@ghh.com",15,
        "xyz4@ghh.com",2],
      "reciever":[
        "xyz3@ghh.com",21,
        "xyz2@ghh.com",12,
        "xyz1@ghh.com",13,
        "xyz9@ghh.com",4],

yes you need to loop through the result set at least once !!. try facet.pivot .this might help you. which is solr4.0 feature

karunakar
  • 76
  • 7