There are some categories of facets where it makes sense to allow the
selection of multiple values, and still show the counts (and the
ability to select) currently unselected values.

Here's a simple example with a multi-select facet "type", and a
traditional facet "author".

---------- type ----------
 x pdf (32)
    word (17)
 x html(46)
    excel(11)

-------- author --------
 erik (31)
 grant (27)
 yonik (14)

Currently, Solr doesn't support this well - all facets generated use
the same base doc set.

Here is what a request currently looks like:
q=foo&fq=date:[1 TO 2]&fq=securityfilter:42&fq=type:(pdf OR
html)&facet.field=author&facet.field=type

The problem of course is that the counts for "word" and "excel" would
come back as "0".  What is needed is to ignore any constraints on
"type" when faceting on that field.

Option #1: ability to specify the query/filters per-facet:
   f.type.facet.base=+foo +date:[1 TO 2] +securityfilter:42
     OR, specify all the parts as field-specific fqs for better caching
   f.type.facet.base=foo&f.type.facet.fq=date:[1 TO
2]&f.type.facet.fq=securityfilter:42
Downsides:
  - field-specific parameters don't work for facet queries, which may
also want this feature.
  - complex filters are repeated and re-parsed.

Option #2: ability to specify as a "local param" (meta-data on a parameter)
  facet.field={!base='f.type.facet.base=+foo +date:[1 TO 2]
+securityfilter:42'}type
Upsides:
  - can work for filter.query params
Downsides:
  - client needs to escape big query string
  - single "base" parameter not good for caching
  - complex filters are repeated and re-parsed.

Option #3: tag parts of a request using "local params"
q=foo&fq=date:[1 TO 2]&fq=securityfilter:42&fq={!tag=type}type:(pdf OR
html)&facet.field=type
    &facet.field={!exclude=type}author

So here, one fq is tagged with "type" {!tag=type}
and then excluded when faceting on author.
Upsides:
  - don't necessarily need to repeat and re-parse params since they
are referenced by name/tag.
  - tagging is a generic mechanism that can be used for other functionality.

Thoughts?

-Yonik

Reply via email to