First I will explain my problem-

My Solr Db schema is as follows
*(SNo,Id,Name,Date,Metadata1,Metadata2.....Metadata30)*.
/Here Id field is not unique. /

Data Set Example:- 
<"1","1","Alex","20/1/2017","blah1","blah2"...>
<"2","1","Alex","12/1/2017","blah1","blah2"...>
<"3","2","Amanda","14/1/2017","blah1","blah3"...>
<"4","2","Amanda","15/1/2017","blah1","blah3"...>
<"5","2","Amanda","16/1/2017","blah1","blah3"...>
<"6","3","Charles","16/1/2017","blah1","blah"...>
<"7","3","charles","17/1/2017","blah1","blah"...>
<"8","4","Alex","20/1/2017","blah2","blah2"...>
<"9","4","Alex","12/1/2017","blah2","blah2"...>
<"10","5","Amanda","14/1/2017","blah3","blah3"...>
<"11","5","Amanda","15/1/2017","blah3","blah3"...>
<"12","5","Amanda","16/1/2017","blah4","blah3"...>
<"13","6","Charles","16/1/2017","blah4","blah"...>
<"14","6","charles","17/1/2017","blah5","blah"...>

When i execute facet query on *Metadata1 *
Expected Result  - *blah1(3),blah2(1),blah3(1),blah4(2),blah5(1)*
Actual Result      -  *blah1(7),blah2(2),blah3(2),blah4(2),blah5(1)*

So I reckoned that the count is calculated on the basis of *Doucment Unique
Id(Sno)*.
Then i found out about *Pivot Faceting* which is a very cool feature so i
modified my query like this- (*pivot=Metadata1,Id*)
Now the result i get is 

Output:-
*Actual result*
Facet field *(Metadata1)* {
         *blah1 (7)*,
         Pivot filed (*Id*)  {
             *1 (2)
             2 (3)
             3 (2)*
         },
         *blah2 (2)*,
         Pivot filed (*Id*)  {
             *4 (2)*
         },
         *blah3 (2)*,
         Pivot filed (*Id*)  {
             *5 (2)*
         },
         *blah4 (2)*,
         Pivot filed (*Id*)  {
             *4 (1)
             5 (1)*
         },
         *blah5 (1)*,
         Pivot filed (*Id*)  {
             *5 (1)*
         },
}

*Expected Result*
*blah1(3),blah2(1),blah3(1),blah4(2),blah5(1)*

The above approach solves my problem but i get alot of unnecessary content.
*All i need is Unique count on a specific field per metadata field*

I saw the code and i know exactly where i am supposed to make the changes.
But do in need to modify the code ??
I can not afford to have that much network traffic so please suggest me what
are the available options??



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Do-i-need-to-modify-PivotFacetProcessor-Code-tp4315013.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to