CottageLabs/facetview2

Add support for extra_predefined_filters

Closed this issue · 3 comments

I am currently investigating an upgrade from okfn facetview to facetview2.

For the update to be possible, we use predefined filters expressed in ES syntax. As our filters are somewhat complex, it's hard to express them as (facet, filter) pairs and it would be easier to just directly add them to the query. Also, the predefined filters rely on some date fields which can't be added in the current version (as range filters).

@mihaibivol sounds like a reasonable option to include! If you've traced it down to where you'd like these extra_predefined_filters added to the query I'd be very happy to merge a PR.

@mihaibivol sounds like a reasonable option to include! If you've traced it down to where you'd like these extra_predefined_filters added to the query I'd be very happy to merge a PR.

To work as OKFN's facetview, the extra_predefined_filters list could
be added to the "must" query option list:

{"query":{"filtered":
{"filter":{"bool":{"must":[{"term":{"topic":"Agriculture"}}] +
$EXTRA_PREDEFINED_FILTERS}},

"query":{"query_string":{"query":"ok","default_operator":"OR"}}}},
                          .....

@emanuil-tolev I just saw that the fixed_filters option behaves exactly as I intended. Will use this.