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 Jasneet Sabharwal <ja...@ngicorporation.com> on 2011/05/10 10:36:21 UTC
Facet Count Based on Dates
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
--
Thanks& Regards
Jasneet Sabharwal
Re: Facet Count Based on Dates
Posted by Jasneet Sabharwal <ja...@ngicorporation.com>.
Hey Otis,
FieldCollapsing is again a feature of Solr 4.0, anything possible using
the default feature of Solr 3.1. Btw, how can I apply these patches on
Solr 3.1 ?
On 13-05-2011 12:10, Otis Gospodnetic wrote:
> Jasneet,
>
> Like in http://wiki.apache.org/solr/FieldCollapsing ?
>
> Otis
> ----
> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
> Lucene ecosystem search :: http://search-lucene.com/
>
>
>
> ----- Original Message ----
>> From: Jasneet Sabharwal<ja...@ngicorporation.com>
>> To: solr-user@lucene.apache.org
>> Sent: Thu, May 12, 2011 10:14:46 AM
>> Subject: Re: Facet Count Based on Dates
>>
>> Or is it possible to use a Group By query in Solr 3.1 like we do in SQL ?
>> On 12-05-2011 19:37, Jasneet Sabharwal wrote:
>>> Is it possible to use the features of 3.1 by default for my query ?
>>> On 12-05-2011 13:38, Grijesh wrote:
>>>> You can apply patch for Hierarchical faceting on Solr 3.1
>>>>
>>>> -----
>>>> Thanx:
>>>> Grijesh
>>>> www.gettinhahead.co.in
>>>> -- View this message in context:
>> http://lucene.472066.n3.nabble.com/Facet-Count-Based-on-Dates-tp2922371p2930924.html
>>
>>>> Sent from the Solr - User mailing list archive at Nabble.com.
>>>>
>>>
>>
>> -- Regards
>>
>> Jasneet Sabharwal
>> Software Developer
>> NextGen Invent Corporation
>> +91-9871228582
>>
>>
--
Regards
Jasneet Sabharwal
Software Developer
NextGen Invent Corporation
+91-9871228582
Re: Facet Count Based on Dates
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Jasneet,
Like in http://wiki.apache.org/solr/FieldCollapsing ?
Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Lucene ecosystem search :: http://search-lucene.com/
----- Original Message ----
> From: Jasneet Sabharwal <ja...@ngicorporation.com>
> To: solr-user@lucene.apache.org
> Sent: Thu, May 12, 2011 10:14:46 AM
> Subject: Re: Facet Count Based on Dates
>
> Or is it possible to use a Group By query in Solr 3.1 like we do in SQL ?
> On 12-05-2011 19:37, Jasneet Sabharwal wrote:
> > Is it possible to use the features of 3.1 by default for my query ?
> > On 12-05-2011 13:38, Grijesh wrote:
> >> You can apply patch for Hierarchical faceting on Solr 3.1
> >>
> >> -----
> >> Thanx:
> >> Grijesh
> >> www.gettinhahead.co.in
> >> -- View this message in context:
>http://lucene.472066.n3.nabble.com/Facet-Count-Based-on-Dates-tp2922371p2930924.html
>
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
> >
> >
>
>
> -- Regards
>
> Jasneet Sabharwal
> Software Developer
> NextGen Invent Corporation
> +91-9871228582
>
>
Re: Facet Count Based on Dates
Posted by Jasneet Sabharwal <ja...@ngicorporation.com>.
Or is it possible to use a Group By query in Solr 3.1 like we do in SQL ?
On 12-05-2011 19:37, Jasneet Sabharwal wrote:
> Is it possible to use the features of 3.1 by default for my query ?
> On 12-05-2011 13:38, Grijesh wrote:
>> You can apply patch for Hierarchical faceting on Solr 3.1
>>
>> -----
>> Thanx:
>> Grijesh
>> www.gettinhahead.co.in
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Facet-Count-Based-on-Dates-tp2922371p2930924.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>
--
Regards
Jasneet Sabharwal
Software Developer
NextGen Invent Corporation
+91-9871228582
Re: Facet Count Based on Dates
Posted by Jasneet Sabharwal <ja...@ngicorporation.com>.
Is it possible to use the features of 3.1 by default for my query ?
On 12-05-2011 13:38, Grijesh wrote:
> You can apply patch for Hierarchical faceting on Solr 3.1
>
> -----
> Thanx:
> Grijesh
> www.gettinhahead.co.in
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Facet-Count-Based-on-Dates-tp2922371p2930924.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Regards
Jasneet Sabharwal
Software Developer
NextGen Invent Corporation
+91-9871228582
Re: Facet Count Based on Dates
Posted by Grijesh <pi...@gmail.com>.
You can apply patch for Hierarchical faceting on Solr 3.1
-----
Thanx:
Grijesh
www.gettinhahead.co.in
--
View this message in context: http://lucene.472066.n3.nabble.com/Facet-Count-Based-on-Dates-tp2922371p2930924.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Facet Count Based on Dates
Posted by Jasneet Sabharwal <ja...@ngicorporation.com>.
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
Re: Facet Count Based on Dates
Posted by Grijesh <pi...@gmail.com>.
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.