Based on the discussion at #1446824: Support the multi-select facet feature of Solr where the associated counts are maintained as if no contraints have been applied, it would be great if Apache Solr Search Integration could support the multi-select facet feature so that facet counts are displayed as if no constraints have been applied. More details can be found in the "Tagging and excluding Filters" section of the Solr wiki.
The short version of this feature request is that it would allow for Solr to provide the "summary output" functionality of Views contextual filters. Since Solr is specifically designed to calculating aggregate results like this, it would be a more efficient option. It would also allow for Solr to used for more navigational purposes.
Comments
Comment #1
cpliakas commentedPulling directly from the Solr documentation for reference...
Tagging and excluding Filters
One can tag specific filters and exclude those filters when faceting. This is generally needed when doing multi-select faceting.
Consider the following example query with faceting:
q=mainquery&fq=status:public&fq=doctype:pdf&facet=on&facet.field=doctypeBecause everything is already constrained by the filter doctype:pdf, the facet.field=doctype facet command is currently redundant and will return 0 counts for everything except doctype:pdf.
To implement a multi-select facet for doctype, a GUI may want to still display the other doctype values and their associated counts, as if the doctype:pdf constraint had not yet been applied. Example:
To return counts for doctype values that are currently not selected, tag filters that directly constrain doctype, and exclude those filters when faceting on doctype.
q=mainquery&fq=status:public&fq={!tag=dt}doctype:pdf&facet=on&facet.field={!ex=dt}doctypeComment #2
cpliakas commentedTo cross post, danielnolde successfully prototyped this functionality for Search API. Details are at http://drupal.org/node/1446824#comment-5634040, I am sure some of the logic would be relevant to Apache Solr Search Integration's implementation.
Comment #3
nick_vhTagged filters are already available in apachesolr?
see solr_base_query.test for examples :
works perfectly fine, it justs needs to be implemented. What is required from the apachesolr part to make this work with facetapi?
Comment #4
cpliakas commentedWell, there has to be a setting that allows a facet to used a tagged query. This would be a global Facet API setting. Then the Apache Solr Search Integration query type plugins would have to read this setting and set the parameter accordingly. This could be implemented completely in Apache Solr, however I want to make sure this isn't something that should be abstracted by Facet API like the "empty facet" configuration.
Comment #5
nick_vhI'm fully open for any modifications we have to make to the facet api implementation so I propose that we delay this conversation until facetapi comes up with a general solution that apachesolr can implement afterwards. I'll keep track of the similar issue in facetapi issue queue to make sure I don't miss relevant information.
Pay attention because this kind of behavior is very hard to achieve in a non-solr environment and since facetapi works in any environment this might be tricky to generalize?
Comment #6
cpliakas commentedAgreed. This is why I am also open to the backends like Apache Solr providing this option via the adapter's settingsForm() method and handling it completely by itself without any modifications to Facet API. I do see Faceted Navigation for Search supporting this, however I haven't vetted that out completely. Regardless, I really don't think this is a major change. Just a setting provided by the adapter and a few lines of logic in the query type plugin to make the change. I don;t see myself working on this, but I might take a crack at it if a few weeks go by with no progress.
Thanks for your insight,
Chris
Comment #7
pwolanin commentedWe already do this for OR facets. What am I missing?
see in apachesolr, query_type.term.inc:
line 33:
line 63:
Comment #8
nick_vhComment #9
cpliakas commentedI feel foolish :-) Thanks for your attention to this.