You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Rajinimaski <ra...@gmail.com> on 2010/07/16 12:03:13 UTC

Getting facets count on multiple fields by doing a "Group By"


This is Condition example:

I have employee with name Rajani and her ID 2
And another employee name also Rajani ID 3 and another also Rajani with id 4
When i make a facet on name:rajani  and facets on ID ,Results will be like

Name = rajani <count=3>

ID=1  <count=1>
ID= 2 <count=1> 
ID =3 <count=1> 


What I needed is Like 

(Name=Rajani , ID=1) <1>
  (Name=Rajani , ID=2) <1>
  (Name=Rajani , ID=3) <1>

Both facets count in same line so that based on ID i can again easily the
results set

Please let me know faceting like this.... 
 
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Getting-facets-count-on-multiple-fields-by-doing-a-Group-By-tp972105p972105.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Getting facets count on multiple fields by doing a "Group By"

Posted by Jonathan Rochkind <ro...@jhu.edu>.
> I needed to get counts based GRPID clubbed with GRPNAME not different sets


Perhaps using facet.query to write your own "sub queries" that will collect whatever you want?




Re: Getting facets count on multiple fields by doing a "Group By"

Posted by Rajinimaski <ra...@gmail.com>.
@Hemanth,  I understand the functionality of "fl" and also about "facet"...
In my condition example i have mentioned that i need faceted COUNT  that
will be like merging both the fileds ....

Still if I am not clear to you then find below my solr search result's
console view and with what I am finding for indeed:

<results>numfound:4 </>

<doc>
field <"GrpId"=1/>
field <"Grpname"=A/>
</doc>
<doc>
field <"GrpId"=2/>
field <"Grpname"=A/>
</doc>
<doc>
field <"GrpId"=3/>
field <"Grpname"=A/>
</doc>
<doc>
field <"GrpId"=4/>
field <"Grpname"=B/>
</doc>

<facet field/>
<GrpId>
<Grpname>

grpid-1<1>
grpid-2<1>
grpid-3<1>
grpid-4<1>

Grpname-A<3>
Grpname-B<1>

</results>


But what i needed is:

grpid-1,Grpname-A<1>
grpid-2,Grpname-A<1>
grpid-3,Grpname-A<1>
grpid-4,Grpname-B<1>

I needed to get counts based GRPID clubbed with GRPNAME not different sets

 Please let me know any solution for this ...


Regards,
Rajani Maski











On Fri, Jul 16, 2010 at 4:32 PM, hemant.verma [via Lucene] <
ml-node+972194-1943694059-326900@n3.nabble.com<ml...@n3.nabble.com>
> wrote:

> You may be confused what facet is for.
> As your example shows, there is no need for you to use facets.
> Simply do the query and use &fl=Name, ID to get the desired results.
>
> ------------------------------
> View message @
> http://lucene.472066.n3.nabble.com/Getting-facets-count-on-multiple-fields-by-doing-a-Group-By-tp972105p972194.html
> To unsubscribe from Getting facets count on multiple fields by doing a
> "Group By", click here< (link removed) =>.
>
>
>

-- 
View this message in context: http://lucene.472066.n3.nabble.com/Getting-facets-count-on-multiple-fields-by-doing-a-Group-By-tp972105p975133.html
Sent from the Solr - User mailing list archive at Nabble.com.