But Pivot Faceting is a feature of Solr 4.0 and I am using 3.1 as that is a stable built and cant use a a Nightly Build.

The question was: -

I have a schema which has field Polarity which is of type "text" and it can have three values 0,1 or -1 and CreatedAt which is of type "date".

*How can I get count of polarity based on dates. For example, it gives the output that on 5/1/2011 there were 10 counts of 0, 10 counts of 1 and 10 counts of -1
*

If I use the facet query like this :-

http://localhost:8983/solor/select/?q=*:*&facet=true&facet.field=Polarity

Then I get the count of the complete database

<lstname="Polarity">
<intname="0">531477</int>
<intname="1">530682</int>
</lst>

The query : http://localhost:8983/solr/select/?q=*:*%20AND%20CreatedAt:[2011-03-10T00:00:00Z%20TO%202011-03-18T23:59:59Z]&facet=true&facet.date=CreatedAt&facet.date.start=2011-03-10T00:00:00Z&facet.date.end=2011-03-18T23:59:59Z&facet.date.gap=%2B1DAY <http://ec2-50-16-100-114.compute-1.amazonaws.com:8983/solr/select/?q=TweetData:*%20AND%20CreatedAt:[2011-03-10T00:00:00Z%20TO%202011-03-18T23:59:59Z]&facet=true&facet.date=CreatedAt&facet.date.start=2011-03-10T00:00:00Z&facet.date.end=2011-03-18T23:59:59Z&facet.date.gap=%2B1DAY>

Would give me the count of data per day, like this:

<lstname="CreatedAt">
<intname="2011-03-10T00:00:00Z">0</int>
<intname="2011-03-11T00:00:00Z">276262</int>
<intname="2011-03-12T00:00:00Z">183929</int>
<intname="2011-03-13T00:00:00Z">196853</int>
<intname="2011-03-14T00:00:00Z">2967</int>
<intname="2011-03-15T00:00:00Z">22762</int>
<intname="2011-03-16T00:00:00Z">11299</int>
<intname="2011-03-17T00:00:00Z">37433</int>
<intname="2011-03-18T00:00:00Z">14359</int>
<strname="gap">+1DAY</str>
<datename="start">2011-03-10T00:00:00Z</date>
<datename="end">2011-03-19T00:00:00Z</date>
</lst>

How will I be able to get the Polarity count for each date like:-

2011-03-10T00:00:00Z
    Polarity
        0 = 100
        1 = 500
        -1 = 200
2011-03-11T00:00:00Z
    Polarity
        0=100
        1=500
        -1=200

And so on till the date range ends.


On 10-05-2011 15:51, Grijesh wrote:
Have you looked at Pivot Faceting
http://wiki.apache.org/solr/HierarchicalFaceting
http://wiki.apache.org/solr/SimpleFacetParameters#Pivot_.28ie_Decision_Tree.29_Faceting-1

-----
Thanx:
Grijesh
www.gettinhahead.co.in
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Facet-Count-Based-on-Dates-tp2922371p2922541.html
Sent from the Solr - User mailing list archive at Nabble.com.



--
Regards

Jasneet Sabharwal
Software Developer
NextGen Invent Corporation
+91-9871228582

Reply via email to