lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Georg Sorst <georg.so...@gmail.com>
Subject Using function queries for faceting
Date Tue, 04 Apr 2017 10:14:58 GMT
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

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