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 Eric Grobler <im...@googlemail.com> on 2012/01/17 14:34:39 UTC

Function in facet.query like min,max

Hi Solr community,

Is it possible to return the lowest, highest and average price of a search
result using facets?
I tried something like: facet.query={!max(price,0)}
Is it possible and what is the correct syntax?

q=htc android
facet=true
facet.query=price:[* TO 10]
facet.query=price:[11 TO 100]
facet.query=price:[101 TO *]
???  facet.query={!max(price,0)}


Thanks & Regards
Ericz

Re: Function in facet.query like min,max

Posted by Eric Grobler <im...@googlemail.com>.
Hi Erick

Thanks for your feedback.
I will try it tomorrow - if it works it will be perfect for my needs.

Have a nice day
Ericz

On Tue, Jan 17, 2012 at 4:28 PM, Erick Erickson <er...@gmail.com>wrote:

> I don't believe that's the case, have you tried it? From the page
> I referenced:
>
> "The stats component returns simple statistics for indexed
> numeric fields within the DocSet."
>
> And running a very quick test on the example data, I get different
> results when I used *:* and name:maxtor.
>
> That said, I'm not all that familiar with the stats component so I
> could well be wrong.
>
> Best
> Erick
>
> On Tue, Jan 17, 2012 at 11:16 AM, Eric Grobler
> <im...@googlemail.com> wrote:
> > Yes, I have, but unfortunately it works on the whole index and not for a
> > particular query.
> >
> >
> > On Tue, Jan 17, 2012 at 3:37 PM, Erick Erickson <erickerickson@gmail.com
> >wrote:
> >
> >> have you seen the Stats component? See:
> >> http://wiki.apache.org/solr/StatsComponent
> >>
> >> Best
> >> Erick
> >>
> >> On Tue, Jan 17, 2012 at 8:34 AM, Eric Grobler <
> impalaherd@googlemail.com>
> >> wrote:
> >> > Hi Solr community,
> >> >
> >> > Is it possible to return the lowest, highest and average price of a
> >> search
> >> > result using facets?
> >> > I tried something like: facet.query={!max(price,0)}
> >> > Is it possible and what is the correct syntax?
> >> >
> >> > q=htc android
> >> > facet=true
> >> > facet.query=price:[* TO 10]
> >> > facet.query=price:[11 TO 100]
> >> > facet.query=price:[101 TO *]
> >> > ???  facet.query={!max(price,0)}
> >> >
> >> >
> >> > Thanks & Regards
> >> > Ericz
> >>
>

Re: Function in facet.query like min,max

Posted by Erick Erickson <er...@gmail.com>.
I don't believe that's the case, have you tried it? From the page
I referenced:

"The stats component returns simple statistics for indexed
numeric fields within the DocSet."

And running a very quick test on the example data, I get different
results when I used *:* and name:maxtor.

That said, I'm not all that familiar with the stats component so I
could well be wrong.

Best
Erick

On Tue, Jan 17, 2012 at 11:16 AM, Eric Grobler
<im...@googlemail.com> wrote:
> Yes, I have, but unfortunately it works on the whole index and not for a
> particular query.
>
>
> On Tue, Jan 17, 2012 at 3:37 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> have you seen the Stats component? See:
>> http://wiki.apache.org/solr/StatsComponent
>>
>> Best
>> Erick
>>
>> On Tue, Jan 17, 2012 at 8:34 AM, Eric Grobler <im...@googlemail.com>
>> wrote:
>> > Hi Solr community,
>> >
>> > Is it possible to return the lowest, highest and average price of a
>> search
>> > result using facets?
>> > I tried something like: facet.query={!max(price,0)}
>> > Is it possible and what is the correct syntax?
>> >
>> > q=htc android
>> > facet=true
>> > facet.query=price:[* TO 10]
>> > facet.query=price:[11 TO 100]
>> > facet.query=price:[101 TO *]
>> > ???  facet.query={!max(price,0)}
>> >
>> >
>> > Thanks & Regards
>> > Ericz
>>

Re: Function in facet.query like min,max

Posted by Eric Grobler <im...@googlemail.com>.
Yes, I have, but unfortunately it works on the whole index and not for a
particular query.


On Tue, Jan 17, 2012 at 3:37 PM, Erick Erickson <er...@gmail.com>wrote:

> have you seen the Stats component? See:
> http://wiki.apache.org/solr/StatsComponent
>
> Best
> Erick
>
> On Tue, Jan 17, 2012 at 8:34 AM, Eric Grobler <im...@googlemail.com>
> wrote:
> > Hi Solr community,
> >
> > Is it possible to return the lowest, highest and average price of a
> search
> > result using facets?
> > I tried something like: facet.query={!max(price,0)}
> > Is it possible and what is the correct syntax?
> >
> > q=htc android
> > facet=true
> > facet.query=price:[* TO 10]
> > facet.query=price:[11 TO 100]
> > facet.query=price:[101 TO *]
> > ???  facet.query={!max(price,0)}
> >
> >
> > Thanks & Regards
> > Ericz
>

Re: Function in facet.query like min,max

Posted by Erick Erickson <er...@gmail.com>.
have you seen the Stats component? See:
http://wiki.apache.org/solr/StatsComponent

Best
Erick

On Tue, Jan 17, 2012 at 8:34 AM, Eric Grobler <im...@googlemail.com> wrote:
> Hi Solr community,
>
> Is it possible to return the lowest, highest and average price of a search
> result using facets?
> I tried something like: facet.query={!max(price,0)}
> Is it possible and what is the correct syntax?
>
> q=htc android
> facet=true
> facet.query=price:[* TO 10]
> facet.query=price:[11 TO 100]
> facet.query=price:[101 TO *]
> ???  facet.query={!max(price,0)}
>
>
> Thanks & Regards
> Ericz