Hi Mikhail,

thanks, JSON facet domains may actually be the key! Something like (when a
user from group1 is searching):

1. Facet on price_group1
2. Facet on price for all results that do not have price_group1 field using
JSON facet domain
3. Sum up the facet counts

Best,

Georg
Mikhail Khludnev <m...@apache.org> schrieb am Di., 4. Apr. 2017, 17:05:

Exclude users' products, calculate default price facet, then facet only
user's products (in a main query) and sum facet counts. It's probably can
be done with switching domains in json facets.

On Tue, Apr 4, 2017 at 5:43 PM, Georg Sorst <georg.so...@gmail.com> wrote:

> Hi Mikhail,
>
> copying the default field was my first attempt as well - however, the
> system in total has over 50.000 users which may have an individual price
on
> every product (even though they usually don't). Still, with the copying
> approach this results in every document having 50.000 price fields. Solr
> completely chokes trying to import this data.
>
> Best,
> Georg
>
> Mikhail Khludnev <m...@apache.org> schrieb am Di., 4. Apr. 2017 um
> 15:28 Uhr:
>
> > 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.so...@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
> >
>



--
Sincerely yours
Mikhail Khludnev

Reply via email to