Sorting and pagination in Solr json range facet

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sorting and pagination in Solr json range facet

Anil-2
Hi,

Good Morning.

I am trying solr json facet features. sort, offset, limit fields are not
working for Range facet.

and could not find the support in the documentation. is there any way to
achieve sort and pagination for Range facet ? please help.

Documentation of range facet says -

Parameters:

   - field – The numeric field or date field to produce range buckets from
   - mincount – Minimum document count for the bucket to be included in the
   response. Defaults to 0.
   - start – Lower bound of the ranges
   - end – Upper bound of the ranges
   - gap – Size of each range bucket produced
   - hardend – A boolean, which if true means that the last bucket will end
   at “end” even if it is less than “gap” wide. If false, the last bucket will
   be “gap” wide, which may extend past “end”.
   - other – This param indicates that in addition to the counts for each
   range constraint between facet.range.start and facet.range.end, counts
   should also be computed for…
      - "before" all records with field values lower then lower bound of
      the first range
      - "after" all records with field values greater then the upper bound
      of the last range
      - "between" all records with field values between the start and end
      bounds of all ranges
      - "none" compute none of this information
      - "all" shortcut for before, between, and after
   - include – By default, the ranges used to compute range faceting
   between facet.range.start and facet.range.end are inclusive of their lower
   bounds and exclusive of the upper bounds. The “before” range is exclusive
   and the “after” range is inclusive. This default, equivalent to lower
   below, will not result in double counting at the boundaries. This behavior
   can be modified by the facet.range.include param, which can be any
   combination of the following options…
      - "lower" all gap based ranges include their lower bound
      - "upper" all gap based ranges include their upper bound
      - "edge" the first and last gap ranges include their edge bounds (ie:
      lower for the first one, upper for the last one) even if the
corresponding
      upper/lower option is not specified
      - "outer" the “before” and “after” ranges will be inclusive of their
      bounds, even if the first or last ranges already include those boundaries.
      - "all" shorthand for lower, upper, edge, outer



 Thanks,
Anil
Reply | Threaded
Open this post in threaded view
|

Re: Sorting and pagination in Solr json range facet

Erick Erickson
What exactly do you mean by "pagination" here? Facets are computed over
the entire result set. That is, if the number of documents found for the query
is 1,000,000, the facets are returned counted over all 1M docs, even if your
rows parameter is 10. The same numbers will be returned for facets
regardless of the start and rows parameters.

This feels like an XY problem, you're asking how to do X (paginate facets)
to solve problem Y, but haven't stated what Y is. What's the use-case here?

Best,
Erick



On Tue, Jul 10, 2018 at 5:36 AM, Anil <[hidden email]> wrote:

> Hi,
>
> Good Morning.
>
> I am trying solr json facet features. sort, offset, limit fields are not
> working for Range facet.
>
> and could not find the support in the documentation. is there any way to
> achieve sort and pagination for Range facet ? please help.
>
> Documentation of range facet says -
>
> Parameters:
>
>    - field – The numeric field or date field to produce range buckets from
>    - mincount – Minimum document count for the bucket to be included in the
>    response. Defaults to 0.
>    - start – Lower bound of the ranges
>    - end – Upper bound of the ranges
>    - gap – Size of each range bucket produced
>    - hardend – A boolean, which if true means that the last bucket will end
>    at “end” even if it is less than “gap” wide. If false, the last bucket will
>    be “gap” wide, which may extend past “end”.
>    - other – This param indicates that in addition to the counts for each
>    range constraint between facet.range.start and facet.range.end, counts
>    should also be computed for…
>       - "before" all records with field values lower then lower bound of
>       the first range
>       - "after" all records with field values greater then the upper bound
>       of the last range
>       - "between" all records with field values between the start and end
>       bounds of all ranges
>       - "none" compute none of this information
>       - "all" shortcut for before, between, and after
>    - include – By default, the ranges used to compute range faceting
>    between facet.range.start and facet.range.end are inclusive of their lower
>    bounds and exclusive of the upper bounds. The “before” range is exclusive
>    and the “after” range is inclusive. This default, equivalent to lower
>    below, will not result in double counting at the boundaries. This behavior
>    can be modified by the facet.range.include param, which can be any
>    combination of the following options…
>       - "lower" all gap based ranges include their lower bound
>       - "upper" all gap based ranges include their upper bound
>       - "edge" the first and last gap ranges include their edge bounds (ie:
>       lower for the first one, upper for the last one) even if the
> corresponding
>       upper/lower option is not specified
>       - "outer" the “before” and “after” ranges will be inclusive of their
>       bounds, even if the first or last ranges already include those boundaries.
>       - "all" shorthand for lower, upper, edge, outer
>
>
>
>  Thanks,
> Anil
Reply | Threaded
Open this post in threaded view
|

Re: Sorting and pagination in Solr json range facet

Anil-2
HI Eric,

i mean pagination is offset and limit for facet results. Basically i am
trying to sort the daily totals (from json facet field) and apply offset,
limit to the buckets.

json.facet=
{
    daily_totals: {
        type: range,
        field: daily_window,
        start : "2017-11-01T00:00:00Z",
        end : "2018-03-14T00:00:00Z",
        gap:"%+1DAY",
        sort: daily_total,
        mincount:1,
        facet: {
            daily_total: "sum(daily_views)"
        }
    }
}

please let me know if you have any questions. thanks.

Regards,
Anil

On 10 July 2018 at 20:22, Erick Erickson <[hidden email]> wrote:

> What exactly do you mean by "pagination" here? Facets are computed over
> the entire result set. That is, if the number of documents found for the
> query
> is 1,000,000, the facets are returned counted over all 1M docs, even if
> your
> rows parameter is 10. The same numbers will be returned for facets
> regardless of the start and rows parameters.
>
> This feels like an XY problem, you're asking how to do X (paginate facets)
> to solve problem Y, but haven't stated what Y is. What's the use-case here?
>
> Best,
> Erick
>
>
>
> On Tue, Jul 10, 2018 at 5:36 AM, Anil <[hidden email]> wrote:
> > Hi,
> >
> > Good Morning.
> >
> > I am trying solr json facet features. sort, offset, limit fields are not
> > working for Range facet.
> >
> > and could not find the support in the documentation. is there any way to
> > achieve sort and pagination for Range facet ? please help.
> >
> > Documentation of range facet says -
> >
> > Parameters:
> >
> >    - field – The numeric field or date field to produce range buckets
> from
> >    - mincount – Minimum document count for the bucket to be included in
> the
> >    response. Defaults to 0.
> >    - start – Lower bound of the ranges
> >    - end – Upper bound of the ranges
> >    - gap – Size of each range bucket produced
> >    - hardend – A boolean, which if true means that the last bucket will
> end
> >    at “end” even if it is less than “gap” wide. If false, the last
> bucket will
> >    be “gap” wide, which may extend past “end”.
> >    - other – This param indicates that in addition to the counts for each
> >    range constraint between facet.range.start and facet.range.end, counts
> >    should also be computed for…
> >       - "before" all records with field values lower then lower bound of
> >       the first range
> >       - "after" all records with field values greater then the upper
> bound
> >       of the last range
> >       - "between" all records with field values between the start and end
> >       bounds of all ranges
> >       - "none" compute none of this information
> >       - "all" shortcut for before, between, and after
> >    - include – By default, the ranges used to compute range faceting
> >    between facet.range.start and facet.range.end are inclusive of their
> lower
> >    bounds and exclusive of the upper bounds. The “before” range is
> exclusive
> >    and the “after” range is inclusive. This default, equivalent to lower
> >    below, will not result in double counting at the boundaries. This
> behavior
> >    can be modified by the facet.range.include param, which can be any
> >    combination of the following options…
> >       - "lower" all gap based ranges include their lower bound
> >       - "upper" all gap based ranges include their upper bound
> >       - "edge" the first and last gap ranges include their edge bounds
> (ie:
> >       lower for the first one, upper for the last one) even if the
> > corresponding
> >       upper/lower option is not specified
> >       - "outer" the “before” and “after” ranges will be inclusive of
> their
> >       bounds, even if the first or last ranges already include those
> boundaries.
> >       - "all" shorthand for lower, upper, edge, outer
> >
> >
> >
> >  Thanks,
> > Anil
>
Reply | Threaded
Open this post in threaded view
|

Re: Sorting and pagination in Solr json range facet

simon-2
Looking carefully at the documentation for JSON facets, it looks as though
the offset parameter is not supported for range facets, only for term
facets.  You'd have to do pagination in your application.

-Simon

On Tue, Jul 10, 2018 at 11:45 AM, Anil <[hidden email]> wrote:

> HI Eric,
>
> i mean pagination is offset and limit for facet results. Basically i am
> trying to sort the daily totals (from json facet field) and apply offset,
> limit to the buckets.
>
> json.facet=
> {
>     daily_totals: {
>         type: range,
>         field: daily_window,
>         start : "2017-11-01T00:00:00Z",
>         end : "2018-03-14T00:00:00Z",
>         gap:"%+1DAY",
>         sort: daily_total,
>         mincount:1,
>         facet: {
>             daily_total: "sum(daily_views)"
>         }
>     }
> }
>
> please let me know if you have any questions. thanks.
>
> Regards,
> Anil
>
> On 10 July 2018 at 20:22, Erick Erickson <[hidden email]> wrote:
>
> > What exactly do you mean by "pagination" here? Facets are computed over
> > the entire result set. That is, if the number of documents found for the
> > query
> > is 1,000,000, the facets are returned counted over all 1M docs, even if
> > your
> > rows parameter is 10. The same numbers will be returned for facets
> > regardless of the start and rows parameters.
> >
> > This feels like an XY problem, you're asking how to do X (paginate
> facets)
> > to solve problem Y, but haven't stated what Y is. What's the use-case
> here?
> >
> > Best,
> > Erick
> >
> >
> >
> > On Tue, Jul 10, 2018 at 5:36 AM, Anil <[hidden email]> wrote:
> > > Hi,
> > >
> > > Good Morning.
> > >
> > > I am trying solr json facet features. sort, offset, limit fields are
> not
> > > working for Range facet.
> > >
> > > and could not find the support in the documentation. is there any way
> to
> > > achieve sort and pagination for Range facet ? please help.
> > >
> > > Documentation of range facet says -
> > >
> > > Parameters:
> > >
> > >    - field – The numeric field or date field to produce range buckets
> > from
> > >    - mincount – Minimum document count for the bucket to be included in
> > the
> > >    response. Defaults to 0.
> > >    - start – Lower bound of the ranges
> > >    - end – Upper bound of the ranges
> > >    - gap – Size of each range bucket produced
> > >    - hardend – A boolean, which if true means that the last bucket will
> > end
> > >    at “end” even if it is less than “gap” wide. If false, the last
> > bucket will
> > >    be “gap” wide, which may extend past “end”.
> > >    - other – This param indicates that in addition to the counts for
> each
> > >    range constraint between facet.range.start and facet.range.end,
> counts
> > >    should also be computed for…
> > >       - "before" all records with field values lower then lower bound
> of
> > >       the first range
> > >       - "after" all records with field values greater then the upper
> > bound
> > >       of the last range
> > >       - "between" all records with field values between the start and
> end
> > >       bounds of all ranges
> > >       - "none" compute none of this information
> > >       - "all" shortcut for before, between, and after
> > >    - include – By default, the ranges used to compute range faceting
> > >    between facet.range.start and facet.range.end are inclusive of their
> > lower
> > >    bounds and exclusive of the upper bounds. The “before” range is
> > exclusive
> > >    and the “after” range is inclusive. This default, equivalent to
> lower
> > >    below, will not result in double counting at the boundaries. This
> > behavior
> > >    can be modified by the facet.range.include param, which can be any
> > >    combination of the following options…
> > >       - "lower" all gap based ranges include their lower bound
> > >       - "upper" all gap based ranges include their upper bound
> > >       - "edge" the first and last gap ranges include their edge bounds
> > (ie:
> > >       lower for the first one, upper for the last one) even if the
> > > corresponding
> > >       upper/lower option is not specified
> > >       - "outer" the “before” and “after” ranges will be inclusive of
> > their
> > >       bounds, even if the first or last ranges already include those
> > boundaries.
> > >       - "all" shorthand for lower, upper, edge, outer
> > >
> > >
> > >
> > >  Thanks,
> > > Anil
> >
>