[ 
https://issues.apache.org/jira/browse/SOLR-5546?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Raintung Li updated SOLR-5546:
------------------------------

    Description: 
Faceted only provide the count for different type in one field, sometimes we 
will want to aggregate the other field in the same faceted not only count.

The API maybe can use: 
Date Query:
facet=true&facet.date=tTransDate&facet.date.start=NOW/MONTH-12MONTHS&facet.date.end=NOW&facet.date.gap=%2B1MONTH&f.tTransDate.facet.sum.field=amountMoney&f.tTransDate.facet.max.field=amountMoney

Query:
facet=true&facet.query=amountMoney:[*+TO+500]&facet.query=amountMoney:[500+TO+*]&f.query.facet.sum.field=amountMoney

Range:
facet.range=amountMoney&f.amountMoney.facet.range.start=0&f.amountMoney.facet.range.end=1000&f.amountMoney.facet.range.gap=100&f.amountMoney.facet.sum.field=amountMoney

Field:
facet=true&facet.field=amountMoney&f.amountMoney.facet.sum.field=amountMoney


facetd.rt=sum(field1),max(field2),count

that means:
Response XML will be

<lst name="count">
        <int name="2007-08-11T00:00:00.000Z">1</int>
        <int name="2007-08-12T00:00:00.000Z">5</int>
        <int name="2007-08-13T00:00:00.000Z">3</int>
        <int name="2007-08-14T00:00:00.000Z">7</int>
        <int name="2007-08-15T00:00:00.000Z">2</int>
        <int name="2007-08-16T00:00:00.000Z">16</int>
  </lst>
<lst name="sum.field1">
        <int name="2007-08-11T00:00:00.000Z">1</int>
        <int name="2007-08-12T00:00:00.000Z">5</int>
        <int name="2007-08-13T00:00:00.000Z">3</int>
        <int name="2007-08-14T00:00:00.000Z">7</int>
        <int name="2007-08-15T00:00:00.000Z">2</int>
        <int name="2007-08-16T00:00:00.000Z">16</int>
  </lst>
<lst name="max.field2">
        <int name="2007-08-11T00:00:00.000Z">1</int>
        <int name="2007-08-12T00:00:00.000Z">5</int>
        <int name="2007-08-13T00:00:00.000Z">3</int>
        <int name="2007-08-14T00:00:00.000Z">7</int>
        <int name="2007-08-15T00:00:00.000Z">2</int>
        <int name="2007-08-16T00:00:00.000Z">16</int>
  </lst>


  was:
Faceted only provide the count for different type in one field, sometimes we 
will want to aggregate the other field in the same faceted not only count.

The API maybe can use
facetd.rt=sum(field1),max(field2),count

that means:
Response XML will be

<lst name="count">
        <int name="2007-08-11T00:00:00.000Z">1</int>
        <int name="2007-08-12T00:00:00.000Z">5</int>
        <int name="2007-08-13T00:00:00.000Z">3</int>
        <int name="2007-08-14T00:00:00.000Z">7</int>
        <int name="2007-08-15T00:00:00.000Z">2</int>
        <int name="2007-08-16T00:00:00.000Z">16</int>
  </lst>
<lst name="sum(field1)">
        <int name="2007-08-11T00:00:00.000Z">1</int>
        <int name="2007-08-12T00:00:00.000Z">5</int>
        <int name="2007-08-13T00:00:00.000Z">3</int>
        <int name="2007-08-14T00:00:00.000Z">7</int>
        <int name="2007-08-15T00:00:00.000Z">2</int>
        <int name="2007-08-16T00:00:00.000Z">16</int>
  </lst>
<lst name="max(field2)">
        <int name="2007-08-11T00:00:00.000Z">1</int>
        <int name="2007-08-12T00:00:00.000Z">5</int>
        <int name="2007-08-13T00:00:00.000Z">3</int>
        <int name="2007-08-14T00:00:00.000Z">7</int>
        <int name="2007-08-15T00:00:00.000Z">2</int>
        <int name="2007-08-16T00:00:00.000Z">16</int>
  </lst>



> Add the aggregate function in the faceted function
> --------------------------------------------------
>
>                 Key: SOLR-5546
>                 URL: https://issues.apache.org/jira/browse/SOLR-5546
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - Clustering
>    Affects Versions: 4.5.1
>            Reporter: Raintung Li
>
> Faceted only provide the count for different type in one field, sometimes we 
> will want to aggregate the other field in the same faceted not only count.
> The API maybe can use: 
> Date Query:
> facet=true&facet.date=tTransDate&facet.date.start=NOW/MONTH-12MONTHS&facet.date.end=NOW&facet.date.gap=%2B1MONTH&f.tTransDate.facet.sum.field=amountMoney&f.tTransDate.facet.max.field=amountMoney
> Query:
> facet=true&facet.query=amountMoney:[*+TO+500]&facet.query=amountMoney:[500+TO+*]&f.query.facet.sum.field=amountMoney
> Range:
> facet.range=amountMoney&f.amountMoney.facet.range.start=0&f.amountMoney.facet.range.end=1000&f.amountMoney.facet.range.gap=100&f.amountMoney.facet.sum.field=amountMoney
> Field:
> facet=true&facet.field=amountMoney&f.amountMoney.facet.sum.field=amountMoney
> facetd.rt=sum(field1),max(field2),count
> that means:
> Response XML will be
> <lst name="count">
>         <int name="2007-08-11T00:00:00.000Z">1</int>
>         <int name="2007-08-12T00:00:00.000Z">5</int>
>         <int name="2007-08-13T00:00:00.000Z">3</int>
>         <int name="2007-08-14T00:00:00.000Z">7</int>
>         <int name="2007-08-15T00:00:00.000Z">2</int>
>         <int name="2007-08-16T00:00:00.000Z">16</int>
>   </lst>
> <lst name="sum.field1">
>         <int name="2007-08-11T00:00:00.000Z">1</int>
>         <int name="2007-08-12T00:00:00.000Z">5</int>
>         <int name="2007-08-13T00:00:00.000Z">3</int>
>         <int name="2007-08-14T00:00:00.000Z">7</int>
>         <int name="2007-08-15T00:00:00.000Z">2</int>
>         <int name="2007-08-16T00:00:00.000Z">16</int>
>   </lst>
> <lst name="max.field2">
>         <int name="2007-08-11T00:00:00.000Z">1</int>
>         <int name="2007-08-12T00:00:00.000Z">5</int>
>         <int name="2007-08-13T00:00:00.000Z">3</int>
>         <int name="2007-08-14T00:00:00.000Z">7</int>
>         <int name="2007-08-15T00:00:00.000Z">2</int>
>         <int name="2007-08-16T00:00:00.000Z">16</int>
>   </lst>



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to