lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <m...@apache.org>
Subject Re: Using function queries for faceting
Date Tue, 04 Apr 2017 13:28:52 GMT
Hello Georg,
You can probably use {!frange} and  and a few facet.query enumerating price
ranges, but probably it's easier to just copy default price across all
empty price groups in index time.


On Tue, Apr 4, 2017 at 1:14 PM, Georg Sorst <georg.sorst@gmail.com> wrote:

> Hi list!
>
> My documents are eCommerce items. They may have a special price for a
> certain group of users, but not for other groups of users; in that case the
> default price should be used. So the documents look like something like
> this:
>
> item:
>   id: 1
>   price_default: 11.5
>   price_group1: 11.2
> item:
>   id: 2
>   price_default: 12.3
>   price_group2: 12.5
>
> Now when I want to fetch the documents and display the correct price for
> group1 I can use 'fl=def(price_group1,price_default)'. Works like a charm!
> It will return price_group1 for document 1 and price_default for document
> 2.
>
> Is there a way to do this for faceting as well? I've unsuccessfully tried:
>
> * facet.field=def(price_group1,price_default)
> * facet.field=effective_price:def(price_group1,price_default)
> * facet.field={!func}def(price_group1,price_default)
> * facet.field={!func}effective_price:def(price_group1,price_default)
> * json.facet={price:"def(price_group1,price_default)"}
>
> I'm fine with either the "old" facet API or the JSON facets.Any ideas?
>
> Thanks!
> Georg
>



-- 
Sincerely yours
Mikhail Khludnev

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message