Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-5546

Add the aggregate function in the faceted function

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.5.1
    • None
    • contrib - Clustering
    • None

    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>

      Attachments

        Activity

          People

            Unassigned Unassigned
            raintung.li Raintung Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: