Re: Aggregate functions

2019-02-05 Thread naga pradeep dhulipalla
Hey,

Thanks for the reply. I had gone through the link but unable to understand
how can i use facets in the following query

Select duration from tableName where solr_query='{"q":"(appName:\"test\")"}'

I want the query something like

Select SUM(duration) from tableName where solr_query='{"q":"(appName:\"
test\")"}'

Can you help on this.

On Mon, Jan 28, 2019 at 5:55 PM Scott Stults <
sstu...@opensourceconnections.com> wrote:

> Yes. Have a look at the Facet API:
> https://lucene.apache.org/solr/guide/7_5/json-facet-api.html
>
>
> On Mon, Jan 28, 2019 at 6:07 AM naga pradeep dhulipalla <
> naga.prade...@gmail.com> wrote:
>
> > Hi Team,
> >
> >
> >
> > Can we use SUM aggregate function in our SOLR queries. If not is there an
> > alternative to achieve this.
> >
> > My sample query looks like this as mentioned below.
> >
> >
> >
> > Select duration from tableName where
> > solr_query='{"q":"(appName:\"test\")"}'
> >
> >
> >
> > I need the aggregate SUM value of duration column. Thanks for your quick
> > help.
> >
> >
> >
> > Regards
> >
> > Pradeep
> >
> > +917204007740
> >
>
>
> --
> Scott Stults | Founder & Solutions Architect | OpenSource Connections, LLC
> | 434.409.2780
> http://www.opensourceconnections.com
>


Re: Aggregate functions

2019-01-28 Thread Scott Stults
Yes. Have a look at the Facet API:
https://lucene.apache.org/solr/guide/7_5/json-facet-api.html


On Mon, Jan 28, 2019 at 6:07 AM naga pradeep dhulipalla <
naga.prade...@gmail.com> wrote:

> Hi Team,
>
>
>
> Can we use SUM aggregate function in our SOLR queries. If not is there an
> alternative to achieve this.
>
> My sample query looks like this as mentioned below.
>
>
>
> Select duration from tableName where
> solr_query='{"q":"(appName:\"test\")"}'
>
>
>
> I need the aggregate SUM value of duration column. Thanks for your quick
> help.
>
>
>
> Regards
>
> Pradeep
>
> +917204007740
>


-- 
Scott Stults | Founder & Solutions Architect | OpenSource Connections, LLC
| 434.409.2780
http://www.opensourceconnections.com


Aggregate functions

2019-01-28 Thread naga pradeep dhulipalla
Hi Team,



Can we use SUM aggregate function in our SOLR queries. If not is there an
alternative to achieve this.

My sample query looks like this as mentioned below.



Select duration from tableName where solr_query='{"q":"(appName:\"test\")"}'



I need the aggregate SUM value of duration column. Thanks for your quick
help.



Regards

Pradeep

+917204007740


Facet Aggregate Functions precision

2016-10-05 Thread Zheng Lin Edwin Yeo
Hi,

Regarding the Solr JSON Facet Aggregate Functions, is it possible to round
off a value to a specific decimal place?

Currently, the values are like those below, which has more than 10 decimal
place.

  "facets":{
"count":32,
"categories":{
  "buckets":[
{
  "val":"electronics",
  "count":12,
  "x":231.02666823069254,
  "y":2772.3200187683105
},
{
  "val":"memory",
  "count":3,
  "x":86.66333262125652,
  "y":259.98999786376953
},


It will be good if we can only display them only in like 2 decimal place.

Regards,
Edwin


Aggregate functions in Solr entity Queries.

2014-06-24 Thread wenky
Hi,
   Im new to solr and would ike to index my database.It is working fine for
columns.
But in solr I have one which which will take the average value from
database.The avaerage is not saving in solr.
Below is my sample dataconfig.xml



//fields<->Columns





  ..

countValue is always returning zero.
Can anyone help me in this regard.




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Aggregate-functions-in-Solr-entity-Queries-tp4143675.html
Sent from the Solr - User mailing list archive at Nabble.com.


RE: aggregate functions in Solr?

2011-09-27 Thread Steve McKay
> -Original Message-
> From: Esteban Donato [mailto:esteban.don...@gmail.com]
> Sent: Monday, September 26, 2011 2:08 PM
> To: solr-user@lucene.apache.org
> Subject: aggregate functions in Solr?
> 
> Hello guys,
> 
>   I need to implement a functionality which requires something similar
> to aggregate functions in SQL.  My Solr schema looks like this:
> 
> -doc_id: integer
> -date: date
> -value1: integer
> -value2: integer
> 
>   Basically the index contains some numerical values (value1, value2,
> etc) per doc and date.  Given a date range query, I need to return
> some stats consolidated by docs for that given date range.  I typical
> response could be something like this:
> 
> doc_id, sum(value1),  avg(value2),  sum(value1)/sum(value2).
> 
>   I checked StatsComponent using stats.facet=doc_id but it seems it
> doesn't cover my needs (especially for complex stats like
> sum(value1)/sum(value2)).  Also checked FieldCollapsing but I couldn't
> find a way to configure an aggregate function there.
> 
>   Is there any way to implement this, or I will have to resolve it out of
> Solr?
> 
> Regards,
> Esteban

To use your example, you could query 
stats.field=value1&stats.field=value2&stats.facet=doc_id and calculate 
sum(value1)/sum(value2) in a Velocity template. I'm not sure it's a *good* 
solution, but that's a way you could get the results you want in the response 
from Solr.

Steve


aggregate functions in Solr?

2011-09-26 Thread Esteban Donato
Hello guys,

  I need to implement a functionality which requires something similar
to aggregate functions in SQL.  My Solr schema looks like this:

-doc_id: integer
-date: date
-value1: integer
-value2: integer

  Basically the index contains some numerical values (value1, value2,
etc) per doc and date.  Given a date range query, I need to return
some stats consolidated by docs for that given date range.  I typical
response could be something like this:

doc_id, sum(value1),  avg(value2),  sum(value1)/sum(value2).

  I checked StatsComponent using stats.facet=doc_id but it seems it
doesn't cover my needs (especially for complex stats like
sum(value1)/sum(value2)).  Also checked FieldCollapsing but I couldn't
find a way to configure an aggregate function there.

  Is there any way to implement this, or I will have to resolve it out of Solr?

Regards,
Esteban


Re: Return records based on aggregate functions?

2011-08-18 Thread Daniel Skiles
It's actually an analyzed String.  I figured that out after the first test
run.

On Thu, Aug 18, 2011 at 9:00 AM, Erick Erickson wrote:

> Side comment: Is your content field really a "string" value in your
> schema.xml? that's an un-analyzed type and unless you're
> always searching for *exactly* the full contents of the field,
> you'll have problems
>
> Best
> Erick
>
> On Wed, Aug 17, 2011 at 2:20 PM, Daniel Skiles
>  wrote:
> > I've recently started using Solr and I'm stumped by a problem I'm
> currently
> > encountering.  Given that I can't really find anything close to what I'm
> > trying to do on Google or the mailing lists, I figured I'd ask if anyone
> > here had suggestions on how to do it.
> >
> > I currently have a schema that looks more or less like this:
> >
> > uniqueId (string) -- Unique identifier for a record
> > documentId (string) -- Id of document represented by this record
> > contents (string) -- contents of file represented by this record
> > version (float) -- Numeric representation of the version of this document
> >
> >
> > What I'd like to do is submit a query to the server that returns records
> > that match against contents, but only if the record has a version field
> that
> > is the largest value for all records that share the same documentId.
> >
> > In other words, I'd like to be able to only search the most recent
> version
> > of a document in some scenarios.
> >
> > Is this possible with Solr?  I'm at an early enough phase that I'm also
> able
> > to modify my solr schema if necessary.
> >
> > Thank you,
> > Daniel
> >
>


Re: Return records based on aggregate functions?

2011-08-18 Thread Erick Erickson
Side comment: Is your content field really a "string" value in your
schema.xml? that's an un-analyzed type and unless you're
always searching for *exactly* the full contents of the field,
you'll have problems

Best
Erick

On Wed, Aug 17, 2011 at 2:20 PM, Daniel Skiles
 wrote:
> I've recently started using Solr and I'm stumped by a problem I'm currently
> encountering.  Given that I can't really find anything close to what I'm
> trying to do on Google or the mailing lists, I figured I'd ask if anyone
> here had suggestions on how to do it.
>
> I currently have a schema that looks more or less like this:
>
> uniqueId (string) -- Unique identifier for a record
> documentId (string) -- Id of document represented by this record
> contents (string) -- contents of file represented by this record
> version (float) -- Numeric representation of the version of this document
>
>
> What I'd like to do is submit a query to the server that returns records
> that match against contents, but only if the record has a version field that
> is the largest value for all records that share the same documentId.
>
> In other words, I'd like to be able to only search the most recent version
> of a document in some scenarios.
>
> Is this possible with Solr?  I'm at an early enough phase that I'm also able
> to modify my solr schema if necessary.
>
> Thank you,
> Daniel
>


RE: Return records based on aggregate functions?

2011-08-17 Thread Dyer, James
Yes:

solrquery.add("group.main", true);
solrquery.add("group.format", "simple");

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-Original Message-
From: Daniel Skiles [mailto:daniel.ski...@docfinity.com] 
Sent: Wednesday, August 17, 2011 2:15 PM
To: solr-user@lucene.apache.org
Subject: Re: Return records based on aggregate functions?

For response option 1, would I add the group.main=true and
group.format=simple parameters to the SolrQuery object?

On Wed, Aug 17, 2011 at 3:09 PM, Dyer, James wrote:

> For the request end, you can just use something like:
>
> solrquery.add("group", true);
> ..etc..
>
> For the response, you have 3 options:
>
> 1. specify "group.main=true&group.format=simple" .  (note: When I tested
> this on a nightly build from back in February I noticed a significant
> performance impact from using these params although I imagine the version
> that is committed to 3.3 does not have this problem.)
>
> This will return your 1-document-per-group as if it is a regular
> non-grouped query and the response will come back just like any other query.
> (see the wiki: http://wiki.apache.org/solr/Solrj#Reading_Data_from_Solr
>  and the javadocs: 
> http://lucene.apache.org/solr/api/overview-summary.htmlthen scroll to the 
> solrj section.)
>
> 2. Full SolrJ support was just added to the 3.x branch so you'll have to
> use a nightly build (which ought to be stable & production-quality).  See
> https://issues.apache.org/jira/browse/SOLR-2637 for more information.
>  After building the solrj documentation, look for classes that start with
> "Group"
>
> 3. See this posting on how to parse the response "by-hand".  This is for a
> slightly older version of Field Collapsing than what was committed so it
> might not be 100% accurate.
> http://www.lucidimagination.com/search/document/148ba23aec5ee2d8/solrquery_api_for_adding_group_filter
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -Original Message-
> From: Daniel Skiles [mailto:daniel.ski...@docfinity.com]
> Sent: Wednesday, August 17, 2011 1:32 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Return records based on aggregate functions?
>
> Woah.  That looks like exactly what I need.  Thanks you very much.  Is
> there
> any documentation for how to do that using the SolrJ API?
>
> On Wed, Aug 17, 2011 at 2:26 PM, Dyer, James  >wrote:
>
> > Daniel,
> >
> > This looks like a good usecase for FieldCollapsing (see
> > http://wiki.apache.org/solr/FieldCollapsing).  Perhaps try something
> like:
> >
> > &group=true&group.field=documentId&group.limit=1&group.sort=version desc
> >
> > James Dyer
> > E-Commerce Systems
> > Ingram Content Group
> > (615) 213-4311
> >
> >
> > -Original Message-
> > From: Daniel Skiles [mailto:daniel.ski...@docfinity.com]
> > Sent: Wednesday, August 17, 2011 1:20 PM
> > To: solr-user@lucene.apache.org
> > Subject: Return records based on aggregate functions?
> >
> > I've recently started using Solr and I'm stumped by a problem I'm
> currently
> > encountering.  Given that I can't really find anything close to what I'm
> > trying to do on Google or the mailing lists, I figured I'd ask if anyone
> > here had suggestions on how to do it.
> >
> > I currently have a schema that looks more or less like this:
> >
> > uniqueId (string) -- Unique identifier for a record
> > documentId (string) -- Id of document represented by this record
> > contents (string) -- contents of file represented by this record
> > version (float) -- Numeric representation of the version of this document
> >
> >
> > What I'd like to do is submit a query to the server that returns records
> > that match against contents, but only if the record has a version field
> > that
> > is the largest value for all records that share the same documentId.
> >
> > In other words, I'd like to be able to only search the most recent
> version
> > of a document in some scenarios.
> >
> > Is this possible with Solr?  I'm at an early enough phase that I'm also
> > able
> > to modify my solr schema if necessary.
> >
> > Thank you,
> > Daniel
> >
>


Re: Return records based on aggregate functions?

2011-08-17 Thread Daniel Skiles
For response option 1, would I add the group.main=true and
group.format=simple parameters to the SolrQuery object?

On Wed, Aug 17, 2011 at 3:09 PM, Dyer, James wrote:

> For the request end, you can just use something like:
>
> solrquery.add("group", true);
> ..etc..
>
> For the response, you have 3 options:
>
> 1. specify "group.main=true&group.format=simple" .  (note: When I tested
> this on a nightly build from back in February I noticed a significant
> performance impact from using these params although I imagine the version
> that is committed to 3.3 does not have this problem.)
>
> This will return your 1-document-per-group as if it is a regular
> non-grouped query and the response will come back just like any other query.
> (see the wiki: http://wiki.apache.org/solr/Solrj#Reading_Data_from_Solr
>  and the javadocs: 
> http://lucene.apache.org/solr/api/overview-summary.htmlthen scroll to the 
> solrj section.)
>
> 2. Full SolrJ support was just added to the 3.x branch so you'll have to
> use a nightly build (which ought to be stable & production-quality).  See
> https://issues.apache.org/jira/browse/SOLR-2637 for more information.
>  After building the solrj documentation, look for classes that start with
> "Group"
>
> 3. See this posting on how to parse the response "by-hand".  This is for a
> slightly older version of Field Collapsing than what was committed so it
> might not be 100% accurate.
> http://www.lucidimagination.com/search/document/148ba23aec5ee2d8/solrquery_api_for_adding_group_filter
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -Original Message-
> From: Daniel Skiles [mailto:daniel.ski...@docfinity.com]
> Sent: Wednesday, August 17, 2011 1:32 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Return records based on aggregate functions?
>
> Woah.  That looks like exactly what I need.  Thanks you very much.  Is
> there
> any documentation for how to do that using the SolrJ API?
>
> On Wed, Aug 17, 2011 at 2:26 PM, Dyer, James  >wrote:
>
> > Daniel,
> >
> > This looks like a good usecase for FieldCollapsing (see
> > http://wiki.apache.org/solr/FieldCollapsing).  Perhaps try something
> like:
> >
> > &group=true&group.field=documentId&group.limit=1&group.sort=version desc
> >
> > James Dyer
> > E-Commerce Systems
> > Ingram Content Group
> > (615) 213-4311
> >
> >
> > -Original Message-
> > From: Daniel Skiles [mailto:daniel.ski...@docfinity.com]
> > Sent: Wednesday, August 17, 2011 1:20 PM
> > To: solr-user@lucene.apache.org
> > Subject: Return records based on aggregate functions?
> >
> > I've recently started using Solr and I'm stumped by a problem I'm
> currently
> > encountering.  Given that I can't really find anything close to what I'm
> > trying to do on Google or the mailing lists, I figured I'd ask if anyone
> > here had suggestions on how to do it.
> >
> > I currently have a schema that looks more or less like this:
> >
> > uniqueId (string) -- Unique identifier for a record
> > documentId (string) -- Id of document represented by this record
> > contents (string) -- contents of file represented by this record
> > version (float) -- Numeric representation of the version of this document
> >
> >
> > What I'd like to do is submit a query to the server that returns records
> > that match against contents, but only if the record has a version field
> > that
> > is the largest value for all records that share the same documentId.
> >
> > In other words, I'd like to be able to only search the most recent
> version
> > of a document in some scenarios.
> >
> > Is this possible with Solr?  I'm at an early enough phase that I'm also
> > able
> > to modify my solr schema if necessary.
> >
> > Thank you,
> > Daniel
> >
>


RE: Return records based on aggregate functions?

2011-08-17 Thread Dyer, James
For the request end, you can just use something like:

solrquery.add("group", true);
..etc..

For the response, you have 3 options:

1. specify "group.main=true&group.format=simple" .  (note: When I tested this 
on a nightly build from back in February I noticed a significant performance 
impact from using these params although I imagine the version that is committed 
to 3.3 does not have this problem.)

This will return your 1-document-per-group as if it is a regular non-grouped 
query and the response will come back just like any other query.  
(see the wiki: http://wiki.apache.org/solr/Solrj#Reading_Data_from_Solr 
 and the javadocs: http://lucene.apache.org/solr/api/overview-summary.html then 
scroll to the solrj section.) 

2. Full SolrJ support was just added to the 3.x branch so you'll have to use a 
nightly build (which ought to be stable & production-quality).  See 
https://issues.apache.org/jira/browse/SOLR-2637 for more information.  After 
building the solrj documentation, look for classes that start with "Group"

3. See this posting on how to parse the response "by-hand".  This is for a 
slightly older version of Field Collapsing than what was committed so it might 
not be 100% accurate.  
http://www.lucidimagination.com/search/document/148ba23aec5ee2d8/solrquery_api_for_adding_group_filter

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-Original Message-
From: Daniel Skiles [mailto:daniel.ski...@docfinity.com] 
Sent: Wednesday, August 17, 2011 1:32 PM
To: solr-user@lucene.apache.org
Subject: Re: Return records based on aggregate functions?

Woah.  That looks like exactly what I need.  Thanks you very much.  Is there
any documentation for how to do that using the SolrJ API?

On Wed, Aug 17, 2011 at 2:26 PM, Dyer, James wrote:

> Daniel,
>
> This looks like a good usecase for FieldCollapsing (see
> http://wiki.apache.org/solr/FieldCollapsing).  Perhaps try something like:
>
> &group=true&group.field=documentId&group.limit=1&group.sort=version desc
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -Original Message-
> From: Daniel Skiles [mailto:daniel.ski...@docfinity.com]
> Sent: Wednesday, August 17, 2011 1:20 PM
> To: solr-user@lucene.apache.org
> Subject: Return records based on aggregate functions?
>
> I've recently started using Solr and I'm stumped by a problem I'm currently
> encountering.  Given that I can't really find anything close to what I'm
> trying to do on Google or the mailing lists, I figured I'd ask if anyone
> here had suggestions on how to do it.
>
> I currently have a schema that looks more or less like this:
>
> uniqueId (string) -- Unique identifier for a record
> documentId (string) -- Id of document represented by this record
> contents (string) -- contents of file represented by this record
> version (float) -- Numeric representation of the version of this document
>
>
> What I'd like to do is submit a query to the server that returns records
> that match against contents, but only if the record has a version field
> that
> is the largest value for all records that share the same documentId.
>
> In other words, I'd like to be able to only search the most recent version
> of a document in some scenarios.
>
> Is this possible with Solr?  I'm at an early enough phase that I'm also
> able
> to modify my solr schema if necessary.
>
> Thank you,
> Daniel
>


Re: Return records based on aggregate functions?

2011-08-17 Thread Daniel Skiles
Woah.  That looks like exactly what I need.  Thanks you very much.  Is there
any documentation for how to do that using the SolrJ API?

On Wed, Aug 17, 2011 at 2:26 PM, Dyer, James wrote:

> Daniel,
>
> This looks like a good usecase for FieldCollapsing (see
> http://wiki.apache.org/solr/FieldCollapsing).  Perhaps try something like:
>
> &group=true&group.field=documentId&group.limit=1&group.sort=version desc
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -Original Message-
> From: Daniel Skiles [mailto:daniel.ski...@docfinity.com]
> Sent: Wednesday, August 17, 2011 1:20 PM
> To: solr-user@lucene.apache.org
> Subject: Return records based on aggregate functions?
>
> I've recently started using Solr and I'm stumped by a problem I'm currently
> encountering.  Given that I can't really find anything close to what I'm
> trying to do on Google or the mailing lists, I figured I'd ask if anyone
> here had suggestions on how to do it.
>
> I currently have a schema that looks more or less like this:
>
> uniqueId (string) -- Unique identifier for a record
> documentId (string) -- Id of document represented by this record
> contents (string) -- contents of file represented by this record
> version (float) -- Numeric representation of the version of this document
>
>
> What I'd like to do is submit a query to the server that returns records
> that match against contents, but only if the record has a version field
> that
> is the largest value for all records that share the same documentId.
>
> In other words, I'd like to be able to only search the most recent version
> of a document in some scenarios.
>
> Is this possible with Solr?  I'm at an early enough phase that I'm also
> able
> to modify my solr schema if necessary.
>
> Thank you,
> Daniel
>


RE: Return records based on aggregate functions?

2011-08-17 Thread Dyer, James
Daniel,

This looks like a good usecase for FieldCollapsing (see 
http://wiki.apache.org/solr/FieldCollapsing).  Perhaps try something like:

&group=true&group.field=documentId&group.limit=1&group.sort=version desc

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-Original Message-
From: Daniel Skiles [mailto:daniel.ski...@docfinity.com] 
Sent: Wednesday, August 17, 2011 1:20 PM
To: solr-user@lucene.apache.org
Subject: Return records based on aggregate functions?

I've recently started using Solr and I'm stumped by a problem I'm currently
encountering.  Given that I can't really find anything close to what I'm
trying to do on Google or the mailing lists, I figured I'd ask if anyone
here had suggestions on how to do it.

I currently have a schema that looks more or less like this:

uniqueId (string) -- Unique identifier for a record
documentId (string) -- Id of document represented by this record
contents (string) -- contents of file represented by this record
version (float) -- Numeric representation of the version of this document


What I'd like to do is submit a query to the server that returns records
that match against contents, but only if the record has a version field that
is the largest value for all records that share the same documentId.

In other words, I'd like to be able to only search the most recent version
of a document in some scenarios.

Is this possible with Solr?  I'm at an early enough phase that I'm also able
to modify my solr schema if necessary.

Thank you,
Daniel


Return records based on aggregate functions?

2011-08-17 Thread Daniel Skiles
I've recently started using Solr and I'm stumped by a problem I'm currently
encountering.  Given that I can't really find anything close to what I'm
trying to do on Google or the mailing lists, I figured I'd ask if anyone
here had suggestions on how to do it.

I currently have a schema that looks more or less like this:

uniqueId (string) -- Unique identifier for a record
documentId (string) -- Id of document represented by this record
contents (string) -- contents of file represented by this record
version (float) -- Numeric representation of the version of this document


What I'd like to do is submit a query to the server that returns records
that match against contents, but only if the record has a version field that
is the largest value for all records that share the same documentId.

In other words, I'd like to be able to only search the most recent version
of a document in some scenarios.

Is this possible with Solr?  I'm at an early enough phase that I'm also able
to modify my solr schema if necessary.

Thank you,
Daniel


Aggregate functions on faceted result

2010-03-11 Thread Marcus Herou
Hi.

We would like to be able to create trend graphs which have date in the
X-axle and sum(pagerank) on the Y-Axle. We have the field pageRank stored as
an external field (since it is updated all the time).

I have started to build a SearchComponent which will be named something like
FacetFunctionComponent but felt that I should drop a mail here asking if it
is already possible.

Is it even remotely possible to create this function in SOLR ?

Cheers

//Marcus Herou


-- 
Marcus Herou CTO and co-founder Tailsweep AB
+46702561312
marcus.he...@tailsweep.com
http://www.tailsweep.com/


Re: Buzz measurement - Aggregate functions

2008-10-10 Thread Marcus Herou
Man I friend made me realize that facets will do the exact thing I want!

Example:

GET "
http://192.168.10.12:8110/solr/feedItem/select/?indent=true&q=title:test*&rows=0&facet=true&facet.date=publishDate&facet.date.start=NOW/DAY-30DAYS&facet.date.end=NOW/DAY%2B1DAY&facet.date.gap=%2B1DAY
"




 0
 22
 
  NOW/DAY-30DAYS
  true
  true
  title:test*
  publishDate
  +1DAY
  NOW/DAY+1DAY
  0
 



 
 
 
  
52
57
34
38
32
53
38
53
64
49
30
37
43
37
40
21
23
21
34
43
50
39
49
25
22
15
28
4
0
0
0
+1DAY
2008-10-11T00:00:00Z
  
 





On Fri, Oct 10, 2008 at 11:42 AM, Uri Boness <[EMAIL PROTECTED]> wrote:

> you can try using the field collapse patch (currently in JIRA). You'll
> probably need to manually extract the patch code and apply it yourself as
> its latest update only applies to an earlier version of solr (1.3-dev).
>
> http://issues.apache.org/jira/browse/SOLR-236
>
> Cheers,
> Uri
>
>
> Marcus Herou wrote:
>
>> Hi.
>>
>> Anyone have an idea of how I would create a query which finds the data
>> backing a trend graph where date is X and num(docs) is on Y axis ?
>>
>> This is quite a common use case in "buzz" analysis and currently I'm doing
>> a
>> stupid query which iterates over the date range and queries lucene for
>> every
>> date. Not very fast and not very flexible.
>>
>> More specifically something like this but I need to add free text query as
>> well and then I cannot use MySQL for performance reasons. Any ideas ?
>>
>> --clip--
>> mysql> select count(id) as Y,publishDate as X from FeedItem where
>> publishDate between "2008-08-01" and "2008-08-31" group by
>> DAY(publishDate)
>> order by publishDate asc;
>> +---+-+
>> | Y | X   |
>> +---+-+
>> | 26663 | 2008-08-01 00:00:00 |
>> | 22478 | 2008-08-02 00:00:00 |
>> | 25745 | 2008-08-03 00:00:00 |
>> | 30576 | 2008-08-04 00:00:00 |
>> | 31351 | 2008-08-05 00:00:00 |
>> | 31084 | 2008-08-06 00:00:00 |
>> | 31245 | 2008-08-07 00:00:00 |
>> | 29518 | 2008-08-08 00:00:00 |
>> | 26001 | 2008-08-09 00:00:00 |
>> | 28687 | 2008-08-10 00:00:00 |
>> | 32957 | 2008-08-11 00:00:00 |
>> | 33251 | 2008-08-12 00:00:00 |
>> | 33062 | 2008-08-13 00:00:00 |
>> | 33960 | 2008-08-14 00:00:00 |
>> | 31034 | 2008-08-15 00:00:00 |
>> | 26726 | 2008-08-16 00:00:00 |
>> | 27543 | 2008-08-17 00:00:00 |
>> | 36887 | 2008-08-18 00:00:00 |
>> | 35376 | 2008-08-19 00:00:00 |
>> | 34573 | 2008-08-20 00:00:00 |
>> | 33889 | 2008-08-21 00:00:00 |
>> | 30604 | 2008-08-22 00:00:00 |
>> | 26875 | 2008-08-23 00:00:00 |
>> | 27356 | 2008-08-24 00:00:00 |
>> | 33438 | 2008-08-25 00:00:00 |
>> | 33102 | 2008-08-26 00:00:00 |
>> | 31720 | 2008-08-27 00:00:00 |
>> | 26133 | 2008-08-28 00:00:00 |
>> | 22781 | 2008-08-29 00:00:00 |
>> | 20198 | 2008-08-30 00:00:00 |
>> |20 | 2008-08-31 00:00:00 |
>> +---+-+
>>
>>
>>
>>
>
>


-- 
Marcus Herou CTO and co-founder Tailsweep AB
+46702561312
[EMAIL PROTECTED]
http://www.tailsweep.com/
http://blogg.tailsweep.com/


Re: Buzz measurement - Aggregate functions

2008-10-10 Thread Uri Boness
you can try using the field collapse patch (currently in JIRA). You'll 
probably need to manually extract the patch code and apply it yourself 
as its latest update only applies to an earlier version of solr (1.3-dev).


http://issues.apache.org/jira/browse/SOLR-236

Cheers,
Uri

Marcus Herou wrote:

Hi.

Anyone have an idea of how I would create a query which finds the data
backing a trend graph where date is X and num(docs) is on Y axis ?

This is quite a common use case in "buzz" analysis and currently I'm doing a
stupid query which iterates over the date range and queries lucene for every
date. Not very fast and not very flexible.

More specifically something like this but I need to add free text query as
well and then I cannot use MySQL for performance reasons. Any ideas ?

--clip--
mysql> select count(id) as Y,publishDate as X from FeedItem where
publishDate between "2008-08-01" and "2008-08-31" group by DAY(publishDate)
order by publishDate asc;
+---+-+
| Y | X   |
+---+-+
| 26663 | 2008-08-01 00:00:00 |
| 22478 | 2008-08-02 00:00:00 |
| 25745 | 2008-08-03 00:00:00 |
| 30576 | 2008-08-04 00:00:00 |
| 31351 | 2008-08-05 00:00:00 |
| 31084 | 2008-08-06 00:00:00 |
| 31245 | 2008-08-07 00:00:00 |
| 29518 | 2008-08-08 00:00:00 |
| 26001 | 2008-08-09 00:00:00 |
| 28687 | 2008-08-10 00:00:00 |
| 32957 | 2008-08-11 00:00:00 |
| 33251 | 2008-08-12 00:00:00 |
| 33062 | 2008-08-13 00:00:00 |
| 33960 | 2008-08-14 00:00:00 |
| 31034 | 2008-08-15 00:00:00 |
| 26726 | 2008-08-16 00:00:00 |
| 27543 | 2008-08-17 00:00:00 |
| 36887 | 2008-08-18 00:00:00 |
| 35376 | 2008-08-19 00:00:00 |
| 34573 | 2008-08-20 00:00:00 |
| 33889 | 2008-08-21 00:00:00 |
| 30604 | 2008-08-22 00:00:00 |
| 26875 | 2008-08-23 00:00:00 |
| 27356 | 2008-08-24 00:00:00 |
| 33438 | 2008-08-25 00:00:00 |
| 33102 | 2008-08-26 00:00:00 |
| 31720 | 2008-08-27 00:00:00 |
| 26133 | 2008-08-28 00:00:00 |
| 22781 | 2008-08-29 00:00:00 |
| 20198 | 2008-08-30 00:00:00 |
|20 | 2008-08-31 00:00:00 |
+---+-+


  




Buzz measurement - Aggregate functions

2008-10-10 Thread Marcus Herou
Hi.

Anyone have an idea of how I would create a query which finds the data
backing a trend graph where date is X and num(docs) is on Y axis ?

This is quite a common use case in "buzz" analysis and currently I'm doing a
stupid query which iterates over the date range and queries lucene for every
date. Not very fast and not very flexible.

More specifically something like this but I need to add free text query as
well and then I cannot use MySQL for performance reasons. Any ideas ?

--clip--
mysql> select count(id) as Y,publishDate as X from FeedItem where
publishDate between "2008-08-01" and "2008-08-31" group by DAY(publishDate)
order by publishDate asc;
+---+-+
| Y | X   |
+---+-+
| 26663 | 2008-08-01 00:00:00 |
| 22478 | 2008-08-02 00:00:00 |
| 25745 | 2008-08-03 00:00:00 |
| 30576 | 2008-08-04 00:00:00 |
| 31351 | 2008-08-05 00:00:00 |
| 31084 | 2008-08-06 00:00:00 |
| 31245 | 2008-08-07 00:00:00 |
| 29518 | 2008-08-08 00:00:00 |
| 26001 | 2008-08-09 00:00:00 |
| 28687 | 2008-08-10 00:00:00 |
| 32957 | 2008-08-11 00:00:00 |
| 33251 | 2008-08-12 00:00:00 |
| 33062 | 2008-08-13 00:00:00 |
| 33960 | 2008-08-14 00:00:00 |
| 31034 | 2008-08-15 00:00:00 |
| 26726 | 2008-08-16 00:00:00 |
| 27543 | 2008-08-17 00:00:00 |
| 36887 | 2008-08-18 00:00:00 |
| 35376 | 2008-08-19 00:00:00 |
| 34573 | 2008-08-20 00:00:00 |
| 33889 | 2008-08-21 00:00:00 |
| 30604 | 2008-08-22 00:00:00 |
| 26875 | 2008-08-23 00:00:00 |
| 27356 | 2008-08-24 00:00:00 |
| 33438 | 2008-08-25 00:00:00 |
| 33102 | 2008-08-26 00:00:00 |
| 31720 | 2008-08-27 00:00:00 |
| 26133 | 2008-08-28 00:00:00 |
| 22781 | 2008-08-29 00:00:00 |
| 20198 | 2008-08-30 00:00:00 |
|20 | 2008-08-31 00:00:00 |
+---+-+


-- 
Marcus Herou CTO and co-founder Tailsweep AB
+46702561312
[EMAIL PROTECTED]
http://www.tailsweep.com/
http://blogg.tailsweep.com/



-- 
Marcus Herou CTO and co-founder Tailsweep AB
+46702561312
[EMAIL PROTECTED]
http://www.tailsweep.com/
http://blogg.tailsweep.com/