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 Ahmed Adel <aa...@gmail.com> on 2019/07/02 14:38:08 UTC

Faceting with Stats

Hi,

How can stats field value be calculated for top facet values? In other
words, the following request parameters should return the stats.field
measures for facets sorted by count:

q: *
wt: json
stats: true
stats.facet: authors_s
stats.field: average_rating_f
facet.missing: true
f.authors_s.facet.sort: count

However, the response is not sorted by facet field count. Is there
something missing?

Best,
A.

Re: Faceting with Stats

Posted by Erick Erickson <er...@gmail.com>.
Thanks for bring closure to this. Yeah, “escaping hell” is something that
happens to us all, something that works in a browser doesn’t work
from SolrJ and neither one may work with curl and……

Pretty often, BTW, I look at the Solr log. It takes a little practice to 
reconstruct the query, but it’s not very hard. Then I work 
backwards…

Best,
Erick

> On Jul 4, 2019, at 11:14 PM, Ahmed Adel <aa...@gmail.com> wrote:
> 
> Thanks for your reply! Yes, it turned out to be an issue with the way the
> request was being sent, which was cURL that required special handling and
> escaping of spaces and special characters. Using another client cleared
> this issue and the request below worked perfectly now.
> 
> Best,
> A.
> 
> On Thu, Jul 4, 2019 at 4:53 PM Erick Erickson <er...@gmail.com>
> wrote:
> 
>> Might be a formatting error with my mail client, but the very first line
>> is not well formed.
>> 
>> q: * is incorrect
>> 
>> q=*:*
>> 
>> 
>> 
>> I do not see that example on the page either. Looks like you took the bit
>> that starts with stats=true and mis-typed the q clause.
>> 
>> Best,
>> Erick
>>> On Jul 3, 2019, at 5:08 AM, Ahmed Adel <aa...@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> As per the documentation recommendation of using pivot with stats
>> component
>>> instead (
>>> 
>> https://lucene.apache.org/solr/guide/8_1/faceting.html#combining-stats-component-with-pivots
>> ),
>>> replacing the stats options that were previously used with the newer
>> pivot
>>> options as follows:
>>> 
>>> q: *
>>> stats=true
>>> stats.field={!tag=piv1 mean=true}average_rating_f
>>> facet=true
>>> facet.pivot={!stats=piv1}author_s
>>> 
>>> returns the following error:
>>> 
>>> Bad Message 400
>>> reason: Illegal character SPACE=' '
>>> 
>>> This is a syntax issue rather than a logical one, however. Any thoughts
>> of
>>> what could be missing would be appreciated.
>>> 
>>> Thanks,
>>> A. Adel
>>> 
>>> On Tue, Jul 2, 2019 at 4:38 PM Ahmed Adel <aa...@gmail.com> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> How can stats field value be calculated for top facet values? In other
>>>> words, the following request parameters should return the stats.field
>>>> measures for facets sorted by count:
>>>> 
>>>> q: *
>>>> wt: json
>>>> stats: true
>>>> stats.facet: authors_s
>>>> stats.field: average_rating_f
>>>> facet.missing: true
>>>> f.authors_s.facet.sort: count
>>>> 
>>>> However, the response is not sorted by facet field count. Is there
>>>> something missing?
>>>> 
>>>> Best,
>>>> A.
>>>> 
>> 
>> --
> Sent from my iPhone


Re: Faceting with Stats

Posted by Ahmed Adel <aa...@gmail.com>.
Thanks for your reply! Yes, it turned out to be an issue with the way the
request was being sent, which was cURL that required special handling and
escaping of spaces and special characters. Using another client cleared
this issue and the request below worked perfectly now.

Best,
A.

On Thu, Jul 4, 2019 at 4:53 PM Erick Erickson <er...@gmail.com>
wrote:

> Might be a formatting error with my mail client, but the very first line
> is not well formed.
>
> q: * is incorrect
>
> q=*:*
>
>
>
> I do not see that example on the page either. Looks like you took the bit
> that starts with stats=true and mis-typed the q clause.
>
> Best,
> Erick
> > On Jul 3, 2019, at 5:08 AM, Ahmed Adel <aa...@gmail.com> wrote:
> >
> > Hi,
> >
> > As per the documentation recommendation of using pivot with stats
> component
> > instead (
> >
> https://lucene.apache.org/solr/guide/8_1/faceting.html#combining-stats-component-with-pivots
> ),
> > replacing the stats options that were previously used with the newer
> pivot
> > options as follows:
> >
> > q: *
> > stats=true
> > stats.field={!tag=piv1 mean=true}average_rating_f
> > facet=true
> > facet.pivot={!stats=piv1}author_s
> >
> > returns the following error:
> >
> > Bad Message 400
> > reason: Illegal character SPACE=' '
> >
> > This is a syntax issue rather than a logical one, however. Any thoughts
> of
> > what could be missing would be appreciated.
> >
> > Thanks,
> > A. Adel
> >
> > On Tue, Jul 2, 2019 at 4:38 PM Ahmed Adel <aa...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> How can stats field value be calculated for top facet values? In other
> >> words, the following request parameters should return the stats.field
> >> measures for facets sorted by count:
> >>
> >> q: *
> >> wt: json
> >> stats: true
> >> stats.facet: authors_s
> >> stats.field: average_rating_f
> >> facet.missing: true
> >> f.authors_s.facet.sort: count
> >>
> >> However, the response is not sorted by facet field count. Is there
> >> something missing?
> >>
> >> Best,
> >> A.
> >>
>
> --
Sent from my iPhone

Re: Faceting with Stats

Posted by Erick Erickson <er...@gmail.com>.
Might be a formatting error with my mail client, but the very first line is not well formed. 

q: * is incorrect

q=*:*



I do not see that example on the page either. Looks like you took the bit
that starts with stats=true and mis-typed the q clause.

Best,
Erick
> On Jul 3, 2019, at 5:08 AM, Ahmed Adel <aa...@gmail.com> wrote:
> 
> Hi,
> 
> As per the documentation recommendation of using pivot with stats component
> instead (
> https://lucene.apache.org/solr/guide/8_1/faceting.html#combining-stats-component-with-pivots),
> replacing the stats options that were previously used with the newer pivot
> options as follows:
> 
> q: *
> stats=true
> stats.field={!tag=piv1 mean=true}average_rating_f
> facet=true
> facet.pivot={!stats=piv1}author_s
> 
> returns the following error:
> 
> Bad Message 400
> reason: Illegal character SPACE=' '
> 
> This is a syntax issue rather than a logical one, however. Any thoughts of
> what could be missing would be appreciated.
> 
> Thanks,
> A. Adel
> 
> On Tue, Jul 2, 2019 at 4:38 PM Ahmed Adel <aa...@gmail.com> wrote:
> 
>> Hi,
>> 
>> How can stats field value be calculated for top facet values? In other
>> words, the following request parameters should return the stats.field
>> measures for facets sorted by count:
>> 
>> q: *
>> wt: json
>> stats: true
>> stats.facet: authors_s
>> stats.field: average_rating_f
>> facet.missing: true
>> f.authors_s.facet.sort: count
>> 
>> However, the response is not sorted by facet field count. Is there
>> something missing?
>> 
>> Best,
>> A.
>> 


Re: Faceting with Stats

Posted by Ahmed Adel <aa...@gmail.com>.
Hi,

As per the documentation recommendation of using pivot with stats component
instead (
https://lucene.apache.org/solr/guide/8_1/faceting.html#combining-stats-component-with-pivots),
replacing the stats options that were previously used with the newer pivot
options as follows:

q: *
stats=true
stats.field={!tag=piv1 mean=true}average_rating_f
facet=true
facet.pivot={!stats=piv1}author_s

returns the following error:

Bad Message 400
reason: Illegal character SPACE=' '

This is a syntax issue rather than a logical one, however. Any thoughts of
what could be missing would be appreciated.

Thanks,
A. Adel

On Tue, Jul 2, 2019 at 4:38 PM Ahmed Adel <aa...@gmail.com> wrote:

> Hi,
>
> How can stats field value be calculated for top facet values? In other
> words, the following request parameters should return the stats.field
> measures for facets sorted by count:
>
> q: *
> wt: json
> stats: true
> stats.facet: authors_s
> stats.field: average_rating_f
> facet.missing: true
> f.authors_s.facet.sort: count
>
> However, the response is not sorted by facet field count. Is there
> something missing?
>
> Best,
> A.
>

Re: Faceting with Stats

Posted by Ahmed Adel <aa...@gmail.com>.
Hi,

As per the documentation recommendation of using pivot with stats component
instead (
https://lucene.apache.org/solr/guide/8_1/faceting.html#combining-stats-component-with-pivots),
replacing the stats options that were previously used with the newer pivot
options as follows:

q: *
stats=true
stats.field={!tag=piv1 mean=true}average_rating_f
facet=true
facet.pivot={!stats=piv1}author_s

returns the following error:

Bad Message 400
reason: Illegal character SPACE=' '

This is a syntax issue rather than a logical one, however. Any thoughts of
what could be missing would be appreciated.

Thanks,
A. Adel

On Tue, Jul 2, 2019 at 4:38 PM Ahmed Adel <aa...@gmail.com> wrote:

> Hi,
>
> How can stats field value be calculated for top facet values? In other
> words, the following request parameters should return the stats.field
> measures for facets sorted by count:
>
> q: *
> wt: json
> stats: true
> stats.facet: authors_s
> stats.field: average_rating_f
> facet.missing: true
> f.authors_s.facet.sort: count
>
> However, the response is not sorted by facet field count. Is there
> something missing?
>
> Best,
> A.
>