Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

allow for facet_raw to receive filter_facet treatment of facet #159

Open
kapilt opened this Issue Jul 29, 2013 · 3 comments

Comments

Projects
None yet
2 participants

kapilt commented Jul 29, 2013

Facet control often needs raw capabilities to extend beyond the simple name search (size, date histogram) however using the interactive query building facilities means this is often done independent of filters. It would be nice if the facet_raw could receive the same facet_filter approach (ie marker None on raw facets could fill with facet queries).

Member

willkg commented Jul 30, 2013

I see how this makes sense, but I'm a purist in that the raw methods are for specifying something with the expectation that elasticutils leaves it entirely alone.

It's not hard to fake the facet_filter, though. We do that in fjord:

https://github.com/mozilla/fjord/blob/master/fjord/analytics/views.py#L390

I'm game for thinking about making that easier to do, but I don't want to do magic with raw things.

kapilt commented Jul 30, 2013

i ended up with a simple subclass, based on the existing magic value
behavior.

class ExtendedS(S):

def _build_query(self):
    q = super(ExtendedS, self)._build_query()
    for f in q.get('facets').values():
        if f.get('facet_filter', 1) is None:
            if q.get('filter'):
                f['facet_filter'] = q['filter']
            else:
                f.pop('facet_filter')
    return q

in this context, i'm not really using the additonal classes beyond S, and
i'd rather not walk the steps to reconstistute.

On Mon, Jul 29, 2013 at 8:14 PM, Will Kahn-Greene
notifications@github.comwrote:

I see how this makes sense, but I'm a purist in that the raw methods are
for specifying something with the expectation that elasticutils leaves it
entirely alone.

It's not hard to fake the facet_filter, though. We do that in fjord:

https://github.com/mozilla/fjord/blob/master/fjord/analytics/views.py#L390

I'm game for thinking about making that easier to do, but I don't want to
do magic with raw things.


Reply to this email directly or view it on GitHubhttps://github.com/mozilla/elasticutils/issues/159#issuecomment-21761389
.

Member

willkg commented Jul 30, 2013

Wow--that's a lot crazier than what we did in Fjord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment